Selenium Java cannot start chromedriver and times out
org.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.
Fix it fast
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);2Match what you see, then jump to its fix
- 1
The 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
A manually downloaded chromedriver sits on the PATH, and the browser was updated after itThe driver and the browser have different major versionsFix - 3
The 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
- 1
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.selenium2Fix
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 testConfirmed by selenium.dev
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 --version2Fix
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 testConfirmed by selenium.dev
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 --debug2Fix
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=true3Verify
Run Selenium Manager again and then the test.
./selenium-manager --browser chrome --debugConfirmed by selenium.dev
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 fixBack end
Android gets HTML instead of JSON from a PHP API
org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject
The response body is not JSON.
2 causes, each with a fixBack end
Apache returns 503 or 504 because PHP-FPM did not answer in time
Error dispatching request
Apache sent the request to PHP-FPM and gave up waiting.
3 causes, each with a fixBack end
Application Load Balancer returns 502 for a Node.js target
HTTPCode_ELB_502_Count
An ALB returns 502 when the target gives it something it cannot use: a refused or reset connection, a connection closed mid-request, a bad response, or a header over 32 K.
4 causes, each with a fixBack end
The AWS SDK for Java cannot find credentials, and AwsCredentials.properties does nothing
software.amazon.awssdk.core.exception.SdkClientException: Unable to load credentials from any of the providers in the chain
AwsCredentials.properties on the classpath is an old convention: the default provider chain of the AWS SDK for Java does not read it.
4 causes, each with a fixBack end
AWS SDK for PHP cannot get credentials from the instance profile metadata server
Error retrieving credentials from the instance profile metadata server.
The SDK tries the EC2 instance metadata service when it has no valid credentials from anywhere earlier in its chain.
4 causes, each with a fix