Read more

Heads Up: Selenium 4 uses a binary to determine the chromedriver

Florian Leinsinger
November 03, 2023Software engineer at makandra GmbH

I recently stumbled over a problem that my feature tests broke in CI because of a mismatching chromedriver version.

Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show snapshot

In this specific project we have a fixed Chromium version in a Debian 12 environment instead of Chrome. The tests however used a recent chrome version instead.

$ chromedriver --version
ChromeDriver 117.0.5938.149 (e3344ddefa12e60436fa28c81cf207c1afb4d0a9-refs/branch-heads/5938@{#1539})
$ chromium --version
Chromium 117.0.5938.149 built on Debian 12.1, running on Debian 12.1

> WARN Selenium [:selenium_manager] The chromedriver version (117.0.5938.149) detected in PATH at /usr/bin/chromedriver
might not be compatible with the detected chrome version (119.0.6045.105);
currently, chromedriver 119.0.6045.105 is recommended for chrome 119.*, so it is advised to delete the driver in PATH and retry 

It turned out that Selenium Webdriver 4 uses a binary called selenium-manager to determine the chromedriver, which probably also downloads Google Chrome for Testing Show snapshot if none is found on the system.

I worked around this behavior by setting the path to the binary in the selenium initializer

Capybara.register_driver :selenium do |app|
  additional_options = {}
  if gitlab_ci?
    additional_options[:binary] = `which chromium`.strip.presence

  options =**additional_options)


You can see the request when you turn off your network connection

WARN Selenium [:selenium_manager] Exception managing chrome: 
error sending request for url ( 
error trying to connect: dns error: failed to lookup address information: Try again
Posted by Florian Leinsinger to makandra dev (2023-11-03 13:50)