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?