Resolve ChromeDriver Issues in Web Test Automation

Where to look when automated tests suddenly don’t work on Chrome, but are fine on Firefox.

Courtney Zhan
4 min readJun 26, 2022

All software has bugs, even from tech giants. I encountered one Google ChromeDriver issue with Chrome v103 last night.

My father documented one issue with chromedriver v75 before: Lessons learned from test failures due to a new ChromeDriver bug.

A Simple Test Failed on Chrome

I was practising test automation against one site and got one test failure quickly (for a simple login test).

Test failed against Chrome

The error message in output:

Failure/Error: driver.get(site_url)
Selenium::WebDriver::Error::UnknownError:
unknown error: cannot determine loading status
from unknown error: unexpected command response

Because this test script (raw Selenium WebDriver) is so simple and I have run this kind of script many times, my first thought was related to the browser.

The Chrome version:

Chrome self-updated recently to v103.

The Same Test Passed on Firefox

I quickly reran the test against Firefox, selecting the Firefox icon on TestWise’s toolbar.

The test passed on Firefox.

It passed! This confirmed my assumption: Chrome browser related, as there was no code change.

Make Sure ChromeDriver Matches

In the context of Web Test Automation using Selenium WebDriver, a browser issue can be either be because of the Browser or its Driver. For example, the Chrome Browser or ChromeDriver.

% chromedriver --version
ChromeDriver 102.0.5005.61

ChromeDriver is one version behind the Chrome browser, but it should still work. ChromeDriver still tends to support the next Chrome browser version — at least that is what I have seen in the past.

So, I updated ChromeDriver. On macOS, we needed to launch the ChromeDriver (chromedriver --version) twice after the update, to get past the security. The process is similar for Windows/Linux.

Click the ‘Cancel’ button, then click the “Allow Anyway” button in the “Security & Privacy” settings dialog. This is because chromedriver releases not code-signed.

Run chromedriver --version again from a terminal. Click the ‘Open’ button in the warning dialog.

% chromedriver --version
ChromeDriver 103.0.5060.53

Reran the test against Chrome, this time with matching ChromeDriver. Still failed with the exact same error message:

Failure/Error: driver.get(site_url)
Selenium::WebDriver::Error::UnknownError:
unknown error: cannot determine loading status
from unknown error: unexpected command response

It seemed that Chrome v103 was the issue. However, it could also mean the ChromeDriver v103 did not update accordingly.

Check the ChromeDriver change log

To clarify my suspicions, I checked the release logs of ChromeDriver.

Bingo! That’s the reason. The solutions:

  1. Revert back to the previous working Chrome v102
    My recommendation, as it is the simplest.
  2. Upgrade to Chrome v104 beta
    Only if you have to, otherwise I will suggest waiting for the final v104.
  3. Set chrome binary path in chrome_options.
    Not recommended, you will need to do so for different platforms.
chrome_options.binary_location = '...';

Some might ask: why don’t just upgrade ChromeDriver to v104? That’s because ChromeDriver only works for the sameand the same — 1 versions of Chrome. (will show the running output shortly)

Revert back to the prior version of Chrome

We can download a prior version of Chrome here, in this case, v102. Standard installation procedure: uninstall/delete the existing version, then run the installer.

With an update to Chrome, I usually install its matching ChromeDriver. Before that, I show you what would happen on test execution.

Selenium::WebDriver::Error::SessionNotCreatedError:
session not created: This version of ChromeDriver only supports Chrome version 103
Current browser version is 102.0.5005.61 with binary path /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

So, I downgraded ChromeDriver (the same procedure shown above). Reran the same test in TestWise, against Chrome.

The test passed!

--

--

No responses yet