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

Updated . Posted . Visible to the public.

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:

options.add_option('w3c', false)

Background: Setting the w3c option to false will enforce a legacy mode Show archive.org snapshot 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:

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.

Florian Leinsinger
Last edit
Henning Koch
License
Source code in this card is licensed under the MIT License.
Posted by Florian Leinsinger to makandra dev (2021-05-31 11:00)