Posted 11 days ago. Visible to the public.

Bug in Chrome 56 prevents filling in fields with slashes using selenium-webdriver/Capybara

There seems to be a nasty bug in Chrome 56 when testing with Selenium and Capybara: Slashes are not written to input fields with fill_in. A workaround is to use javascript / jquery to change the contents of an input field.

Use the following code or add the attached file to your features/support/-directory to overwrite fill_in.

Copy
module ChromedriverWorkarounds def fill_in(locator, options = {}) text = options[:with].to_s if Capybara.current_driver == :selenium && text.include?('/') # There is a nasty Bug in Chrome 56 which fails to write slashes into # text fields for unknown reasons. field = find_field(locator) id = field[:id].presence if id execute_script "$('##{id}').val(#{text.to_json}).change()" else raise "Tried to work around a Chromedriver bug, but that requires the #{locator.inspect} field to have an ID." end else super(locator, options) end end end World(ChromedriverWorkarounds)

Does your version of Ruby on Rails still receive security updates?
Rails LTS provides security patches for old versions of Ruby on Rails (3.2 and 2.3).

Author of this card:

Avatar
Judith Roth
Last edit:
11 days ago
by Henning Koch
Attachments:
chromedriver.rb
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Judith Roth to makandropedia