Posted about 1 month ago. Visible to the public.

Chromedriver: Disabling the w3c option might break your integration tests with Chrome 91

We recently noticed issues with Chrome 75+ when having the w3c option enabled within the Selenium webdriver. It looks like recent Selenium versions don't have any issues with the w3c interface anymore. And starting with Chrome 91 this fix might cause unexpected issues, so you should try to enabled this option again or just remove the following line from you configuration:

Copy
options.add_option('w3c', false)

Background: Setting the w3c option to false will enforce a legacy mode in Chrome starting with version 91. This results in a different value of input.value and input.text (nil instead of empty string) and will cause unexpected errors with Selenium. You will see errors in your integration tests like below if you are affected by the issue:

Copy
The field's content "" did not match "some-text" (RSpec::Expectations::ExpectationNotMetError)

Issue with headless Chrome

After removing the line above in the configuration it could happen that the tests are no longer running in headless mode. Updating the selenium-webdriver gem to >= 3.13.0 fixed the problem.

Issue with old Capybaras

You may also need to upgrade your Capybara version.

Growing Rails Applications in Practice
Check out our new e-book:
Learn to structure large Ruby on Rails codebases with the tools you already know and love.

Owner of this card:

Avatar
Florian Leinsinger
Last edit:
about 1 month ago
by Henning Koch
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Florian Leinsinger to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more