Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

Selenium Java cannot start chromedriver and times out

Errororg.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.

Short answer

Selenium started the driver program and it never became ready, or it could not be started at all. Today the usual reasons are a Selenium older than 4.6 with no driver on the path, a driver whose major version differs from the browser, or Selenium Manager unable to download a driver. Turn on the driver log first.

  • Applies to Selenium 4.x for Java, Chrome stable, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Send the driver's own log to the console. It says whether the driver started, which browser it found, and why it stopped.

    ChromeDriverService service = new ChromeDriverService.Builder()
        .withLogOutput(System.out)
        .withLogLevel(ChromiumDriverLogLevel.DEBUG)
        .build();
    WebDriver driver = new ChromeDriver(service);
  2. 2Match what you see, then jump to its fix

    1. 1The project uses Selenium 3.x or an early 4.x and no chromedriver is on the PATHSelenium is older than 4.6, so nothing finds a driver for youFix
    2. 2A manually downloaded chromedriver sits on the PATH, and the browser was updated after itThe driver and the browser have different major versionsFix
    3. 3The failure only happens on a build server or behind a company proxy, and the driver is not in ~/.cache/seleniumSelenium Manager cannot reach the download serversFix

What does the error look like?

  • org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.

Cause 1 of 3

Selenium is older than 4.6, so nothing finds a driver for you

1Check

Selenium Manager, the built-in driver finder, ships from Selenium 4.6. Check which version your build resolves.

mvn dependency:tree -Dincludes=org.seleniumhq.selenium

2Fix

Upgrade the selenium-java dependency to a current 4.x release and remove any hard-coded webdriver.chrome.driver path, so Selenium Manager can pick the matching driver.

<dependency>
  <groupId>org.seleniumhq.selenium</groupId>
  <artifactId>selenium-java</artifactId>
  <version>4.27.0</version>
</dependency>

3Verify

Run the test again, without any driver path set.

mvn -q test

Confirmed by selenium.dev

Did this fix it?

Cause 2 of 3

The driver and the browser have different major versions

1Check

Chrome and chromedriver must match by major version. Compare the two.

chromedriver --version
google-chrome --version

2Fix

Delete the manually installed driver (or stop pointing at it) and let Selenium Manager fetch the driver that matches the installed browser.

sudo rm /usr/local/bin/chromedriver
# then create the driver with no explicit path:
# WebDriver driver = new ChromeDriver();

3Verify

Run one test that opens a page.

mvn -q test

Confirmed by selenium.dev

Did this fix it?

Cause 3 of 3

Selenium Manager cannot reach the download servers

1Check

Selenium Manager downloads drivers and caches them in ~/.cache/selenium. On a restricted network the lookup fails. Run it with debug output to see the URLs it tries.

ls ~/.cache/selenium
./selenium-manager --browser chrome --debug

2Fix

Give Selenium Manager the proxy through the SE_PROXY environment variable. On a machine with no internet, warm the cache once from a connected machine and run with SE_OFFLINE=true.

export SE_PROXY=http://proxy.example.com:3128
# offline machine with a prepared cache:
export SE_OFFLINE=true

3Verify

Run Selenium Manager again and then the test.

./selenium-manager --browser chrome --debug

Confirmed by selenium.dev

Did this fix it?

How do I stop it coming back?

  • Do not commit a driver binary or a driver path to the repository; let Selenium Manager choose.
  • Keep selenium-java current, and update it when browsers update.
  • On CI, cache ~/.cache/selenium between runs and set the proxy variable in the job environment.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Related fixes

Back end

Spring Boot will not start because port 8080 is already taken

Action: Identify and stop the process that's listening on port 8080 or configure this application to listen on another port.

Spring Boot listens on 8080 unless told otherwise, and only one process can own a port.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.