ChromeDriver 75 enforces w3c standard, breaking Behat tests

Alex Skrypnyk
2 min readJun 6, 2019

--

This was a hard one…

Suddenly, all CI builds started to fail without any changes. The JavaScript tests, that require real browser, were all failing.

Since our builds using official selenium/standalone-chrome Docker image, it was clear that something has changed there, because our CI always pulls latest images before application build.

Quick version check and release dates shown that there was a recent release of Google Chrome and Chrome Driver bundled into new version of selenium/standalone-chrome Docker image.

Release notes did not show much at first, but this line was actually important: “Resolved issue 2536: Make standards mode (goog:chromeOptions.w3c:true) the default [Pri-2]”.

I did not realise it straight away, but the “mode” is actually a communication protocol type that ChromeDriver uses with it’s consumers to relay command to Chrome. And this change was actually enforcing the “w3c” protocol to be enabled by default.

What this lead to had a snowball effect: projects that were using testing frameworks (like Behat), which on its own were using other dependencies, were unable to build and deploy.

Those “other dependencies” are buried quite deep in the dependency tree, but there is one that is actually responsible for implementing WebDriver protocol — https://github.com/instaclick/php-webdriver. Unfortunately, this package does not support “w3c” protocol yet (will it ever?), so all the frameworks depending on it either have to wait for the “w3c” support or switch to another package.

Obviously, this cannot happen straightaway, but we all (poor souls trying to make everything deployable again)need a solution right now.

I can only provide solution for Behat, but other frameworks probably have similar approaches. Main information is captured in this comment https://github.com/minkphp/MinkSelenium2Driver/issues/293#issuecomment-499405228

Behat allows to provide browser capabilities values in “behat.yml” configuration file.

extensions:
Behat\MinkExtension:
selenium2:
capabilities: { “browser”: “chrome”, “version”: “*”, “marionette”: true, “extra_capabilities”: { “chromeOptions”: { “w3c”: false } } }

If you already have “capabilities” set, only add extra_capabilities”: { “chromeOptions”: { “w3c”: false } }

It is important to remember that support for this flag will probably be removed soon and only w3c protocol will be supported.

UPDATE
After more investigation it appeared that another issue now presented itself: clicking elements triggers errors like

“ Webdriver http error: 400, payload :{“value”:{“error”:”invalid argument”,”message”:”invalid argument: missing command parameters”,”stacktrace”:”#0 0x5601240ee299 \u003Cunknown>\n”}} (WebDriver\Exception\CurlExec)”

So far, the only way to overcome this is to stick to the “selenium/standalone-chrome:3.141.59-oxygen” image.

:((

--

--