poltergeist


Poltergeist ruby gem fails to process `:shift` modifier in `send_keys`


It appears that only the :Shift modifier doesn't work in Poltergeist.
Environment
Poltergeist gem 1.9
Phantomjs 2.1.1
OSX El Cap
Rails 4.2.6
The test code that appears to offend is:
#page.find('#category-text').send_keys [:Shift, '.']
page.find('#category-text').send_keys [:Alt, 'a']
In my code, I allow both shift-. (that is, the > symbol), and Alt-a to perform the same function. Both keys work in the browser (Chrome 50+, OSX), but only the 2nd line above works in the test.
Elsewhere in my code and tests, :Ctrl works fine.
Is this something peculiar to how :Shift works on an MBP perhaps?
The issue here is not the :shift key specifically, it's the use of '.' in combination with any modifier (:shift, :alt. :ctrl, etc...). The issue occurs because PhantomJS doesn't provide entries in its keyCode map for punctuation keys (https://github.com/ariya/phantomjs/commit/cab2635e66d74b7e665c44400b8b20a8f225153a) so they end up generating a keyCode of 0.
As a workaround you can call
page.find('#category-text').send_keys [:shift, :period]
which should provide the expected results.
Update: A fix for this is now in Poltergeist master and will be in the 1.11.0 release when it happens

Related Links

How can I use “includeJs” function of phantomjs with poltergeist?
Poltergeist ruby gem fails to process `:shift` modifier in `send_keys`
Using Poltergiest to give user of app a screenshot of their page
Poltergeist 1.9.0 w/Ruby 1.9.3
Post via Capybara and Poltergiest for API testing
Poltergeist current_url command is returning page_info hash instead of a URL
How does one test the content of confirm dialogs using poltergeist?
Using Poltergeist, Phantom JS instances are not exiting during every rspec run
Render page element with padding in Poltergeist
Can I monkey patch the phantomjs browser api with execute_script?
send_keys support for Poltergeist?

Categories

HOME
pandas
winforms
client
urbancode
heroku
platform-builder
sd-card
youtube-dl
framework7
spring-cloud-stream
cmd
malloc
c#-2.0
jpeg
jxls
icloud
baqend
blueprintjs
ezpublish
fancybox
add
amazon-cloudformation
slick-slider
awesome-wm
alignment
n-gram
msp430
caml
graphlab
saxon
angular-ui
contextmenu
graphicsmagick
excel-2007
wpfdatagrid
minitab
elasticsearch-ruby
compatibility
unboundid
functor
scorm2004
http-get
avcapturesession
dosbox
botbuilder
convertapi
galleria
skeleton-css-boilerplate
apache-fop
tizen-native-app
mplayer
tactic
kbuild
boost-preprocessor
ifs
mcafee
blacklist
crosswalk-runtime
cubes
medium.com
lttng
holder.js
angstrom-linux
captivenetwork
xna-4.0
endeca-workbench
spidermonkey
event-bubbling
inmobi
device-orientation
javafx-webengine
bitcoinj
responsive-slides
mechanize-ruby
android-2.2-froyo
concurrent-collections
ivyde
google-cloud-save
ruby-datamapper
dbconnection
qt-faststart
drools-planner
factory-method
angularjs-controller
unc
rdoc
funscript
labwindows
external-accessory
file-comparison
google-friend-connect
ctp4
sustainable-pace
thread-local-storage
post-build

Resources

Encrypt Message