ChromeDriver setup fails

Hey all,

trying to follow the code examples in 2.3.3 Implementing a Basic Check, but it fails when trying to setup the ChromeDriver, at this line: WebDriverManager.chromedriver().setup();

Console Output:

07:58:11.678 [main] INFO io.github.bonigarcia.wdm.WebDriverManager -- Using chromedriver public (resolved driver for Chrome 121)
07:58:11.744 [main] INFO io.github.bonigarcia.wdm.cache.ResolutionCache -- Clearing WebDriverManager resolution cache
07:58:11.748 [main] WARN io.github.bonigarcia.wdm.WebDriverManager -- There was an error managing chromedriver public (For input string: "public") ... trying again avoiding reading release from repository
07:58:13.951 [main] WARN io.github.bonigarcia.wdm.WebDriverManager -- There was an error managing chromedriver (latest version) (For input string: "public") ... trying again using latest driver stored in cache
07:58:13.970 [main] INFO io.github.bonigarcia.wdm.WebDriverManager -- Using chromedriver public (resolved driver for Chrome 121)
07:58:13.994 [main] ERROR io.github.bonigarcia.wdm.WebDriverManager -- There was an error managing chromedriver public (For input string: "public")
java.lang.NumberFormatException: For input string: "public"
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
	at java.base/java.lang.Integer.parseInt(Integer.java:661)
	at java.base/java.lang.Integer.parseInt(Integer.java:777)
	at io.github.bonigarcia.wdm.managers.ChromeDriverManager.buildUrl(ChromeDriverManager.java:178)
	at io.github.bonigarcia.wdm.managers.ChromeDriverManager.buildUrl(ChromeDriverManager.java:155)
	at io.github.bonigarcia.wdm.WebDriverManager.download(WebDriverManager.java:1282)
	at io.github.bonigarcia.wdm.WebDriverManager.manage(WebDriverManager.java:1199)
	at io.github.bonigarcia.wdm.WebDriverManager.fallback(WebDriverManager.java:1461)
	at io.github.bonigarcia.wdm.WebDriverManager.handleException(WebDriverManager.java:1442)
	at io.github.bonigarcia.wdm.WebDriverManager.manage(WebDriverManager.java:1205)
	at io.github.bonigarcia.wdm.WebDriverManager.handleException(WebDriverManager.java:1435)
	at io.github.bonigarcia.wdm.WebDriverManager.manage(WebDriverManager.java:1205)
	at io.github.bonigarcia.wdm.WebDriverManager.setup(WebDriverManager.java:427)
	at com.ministryoftesting.LoginTest.testPageUpdatesToProjectPageAfterLogin(LoginTest.java:21)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:728)
	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
	at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:218)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:214)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:139)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:69)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:198)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:169)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:93)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:58)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:141)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:57)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:103)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:85)
	at org.junit.platform.launcher.core.DelegatingLauncher.execute(DelegatingLauncher.java:47)
	at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:63)
	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
	at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)

io.github.bonigarcia.wdm.config.WebDriverManagerException: java.lang.NumberFormatException: For input string: "public"

	at io.github.bonigarcia.wdm.WebDriverManager.handleException(WebDriverManager.java:1445)
	at io.github.bonigarcia.wdm.WebDriverManager.manage(WebDriverManager.java:1205)
	at io.github.bonigarcia.wdm.WebDriverManager.fallback(WebDriverManager.java:1461)
	at io.github.bonigarcia.wdm.WebDriverManager.handleException(WebDriverManager.java:1442)
	at io.github.bonigarcia.wdm.WebDriverManager.manage(WebDriverManager.java:1205)
	at io.github.bonigarcia.wdm.WebDriverManager.handleException(WebDriverManager.java:1435)
	at io.github.bonigarcia.wdm.WebDriverManager.manage(WebDriverManager.java:1205)
	at io.github.bonigarcia.wdm.WebDriverManager.setup(WebDriverManager.java:427)
	at com.ministryoftesting.LoginTest.testPageUpdatesToProjectPageAfterLogin(LoginTest.java:21)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: java.lang.NumberFormatException: For input string: "public"
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
	at java.base/java.lang.Integer.parseInt(Integer.java:661)
	at java.base/java.lang.Integer.parseInt(Integer.java:777)
	at io.github.bonigarcia.wdm.managers.ChromeDriverManager.buildUrl(ChromeDriverManager.java:178)
	at io.github.bonigarcia.wdm.managers.ChromeDriverManager.buildUrl(ChromeDriverManager.java:155)
	at io.github.bonigarcia.wdm.WebDriverManager.download(WebDriverManager.java:1282)
	at io.github.bonigarcia.wdm.WebDriverManager.manage(WebDriverManager.java:1199)
	... 10 more

I’m on Windows 11, using Java Corretto 21.

As a workaround I used the FirefoxDriver:

WebDriverManager.firefoxdriver().setup();
WebDriver driver = new FirefoxDriver();
1 Like

I couldn’t reproduce this, but a google of the error indicates it might have to do with the WebDriverManger version. The latest version is 5.7.0, so could you try with that.
My problem was it not picking up the correct chromedriver for my browser version, so I also had to follow the instructions in this WebDriverManager help section. You may want to try this too.

5 Likes

I am getting the Same, Tried after updating the WebdriverManager veron from POM file also.

1 Like

Try this code, It worked for me

WebDriverManager.chromedriver().clearDriverCache().setup();
driver = new ChromeDriver();

2 Likes

Thanks Andrew!

Updating WebDriverManager to 5.7.0 didn’t solve the problem.

Using WebDriverManager.chromedriver().clearDriverCache().setup(); open a new Chrome tab in an already opened Chrome instance (see screenshot), and results in a differend error message:

07:24:38.260 [main] INFO io.github.bonigarcia.wdm.WebDriverManager -- Using chromedriver 121.0.6167.184 (resolved driver for Chrome 121)
07:24:38.313 [main] INFO io.github.bonigarcia.wdm.online.Downloader -- Downloading https://storage.googleapis.com/chrome-for-testing-public/121.0.6167.184/win64/chromedriver-win64.zip
07:24:42.037 [main] INFO io.github.bonigarcia.wdm.online.Downloader -- Extracting driver from compressed file chromedriver-win64.zip
07:24:42.245 [main] INFO io.github.bonigarcia.wdm.WebDriverManager -- Exporting webdriver.chrome.driver as C:\Users\ChristianBa\.cache\selenium\chromedriver\win64\121.0.6167.184\chromedriver.exe

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: session not created: Chrome failed to start: exited normally.
  (session not created: DevToolsActivePort file doesn't exist)
  (The process started from chrome location C:\Program Files\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.) 
Host info: host: 'MW-38CMRQ3', ip: '192.168.178.159'
Build info: version: '4.14.1', revision: '03f8ede370'
System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '21.0.1'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}}]}]

	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:140)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:96)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:68)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:163)
	at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:200)
	at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:175)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:602)
	at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:163)
	at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:108)
	at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:88)
	at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:83)
	at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:51)
	at com.ministryoftesting.LoginTest.testPageUpdatesToProjectPageAfterLogin(LoginTest.java:23)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)

1 Like

None of this looks too familiar to me, but whennever I have problems with Chromedriver, its because Google has updated to Chrome and it no longer works with my chromedriver. I think this is deliberate - Firefox/geckodriver seem more forgiving.

Edit: So getting the latest chromedriver might help.

1 Like

Hey Jason,

that’s exactly what the WebDriverManager library is about: It ensures, that you always have the right webdriver for your browser version; it downloads the right webdriver automatically.

You can find more info on the github repo: GitHub - bonigarcia/webdrivermanager: Automated driver management and other helper features for Selenium WebDriver in Java

Cheers,
Chriss

3 Likes

only ever used this lib on Python, and found myself debugging it and eventually writing a cache refresh wrapper around it to kill the webdriver cache which is in a hard-coded-ish location to force refreshes every 24 hours by storing a timer. Guessing though because my java skills are pretty poor, that deleting the cache may help along with adding traces to the lib to prove that it’s fetching the correct driver after google changed the metadata format on the index for chromedrivers when they took over the project. (This was so long ago, that if your driver-manager version is old, it’s going to be obvious though.)

Hi Christian,

I had the same issue but the problem was the url, I wrote the url like this:
www.google.com
When it should be like this:
https://www.google.com/

I hope this works for you

It fails already before opening a site, so that’s not the issue.