Response code 500. Message: session not created: This version of ChromeDriver only supports Chrome version 114
Asked Answered
K

2

2

I got hit by this issue with setting up the webdrivers. I had to update my Chrome to 116.0.5845.97. This is how my maven looks like :

<dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>4.10.0</version>
</dependency>
<dependency>
            <groupId>io.github.bonigarcia</groupId>
            <artifactId>webdrivermanager</artifactId>
            <version>5.4.1</version>
</dependency>

Code for setting up the chrome Options and finally creating the webdriver:

if (browserName.equals("chrome")) {
                WebDriverManager.chromedriver().setup();
                ChromeOptions chromeOptions = new ChromeOptions();
                chromeOptions.addArguments(new String[]{"--incognito"});
                chromeOptions.addArguments(new String[]{"window-size=1980,1080"});
                chromeOptions.addArguments(new String[]{"--remote-allow-origins=*"});
                this.driver = new ChromeDriver(chromeOptions);
}

I am getting the following error:

Starting ChromeDriver 114.0.5735.90 (386bc09e8f4f2e025eddae123f36f6263096ae49-refs/branch-heads/5735@{#1052}) on port 9006
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: session not created: This version of ChromeDriver only supports Chrome version 114
Current browser version is 116.0.5845.97 with binary path C:\Program Files (x86)\Google\Chrome\Application\chrome.exe 

I have not been able to resolve this issue and hence reaching out to experts here.

Kinch answered 18/8, 2023 at 1:3 Comment(0)
S
6

Two issues:

  1. Selenium v4.10.0 supports only up to CDP 114, which means if your browser version is 116, then you need to upgrade selenium to 4.11.0 Update POM as below.
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>4.11.0</version>
</dependency>
  1. If you are using selenium v4.6.0 and above, then you don't need WebDriverManager any more. Selenium has an inbuilt tool now to handle drivers. Remove the below line from your code, you don't need it.
WebDriverManager.chromedriver().setup();
Skiplane answered 18/8, 2023 at 8:46 Comment(3)
Thanks @Shawn, I made the recommended changes but am now getting the following error: java.lang.IllegalStateException: The path to the driver executable The path to the driver executable must be set by the webdriver.chrome.driver system propertyKinch
Are you sure the selenium version is 4.11.0? Double check once. The fact that you are getting this error makes me think you are on lower version of selenium.Skiplane
You are a legend. After refreshing the pom.xml of my framework, I forgot to refresh the pom.xml of my project. It's fixed now and thanks a lot @Shawn(Heartbreak kid :) )Kinch
S
0

Java: pom.xml webdrivermanager 5.4.1 and use the stable version https://googlechromelabs.github.io/chrome-for-testing/ //not working with chrome version 116...(main version), so we are going to hard code for now; //Next, we will pass it as variable with try catch statement to by bypass the hard coding after the fix

      //WebDriverManager.chromedriver().setup(); 
      //hard code Chrome version
      WebDriverManager.chromedriver().driverVersion("116.0.5845.96").setup();
      
      ChromeOptions options = new ChromeOptions(); 
      options.addArguments("--remote-allow-origins=*"); 
      options.addArguments("--start-maximized");
      
      driver =  new ChromeDriver(options); 
Seismography answered 28/8, 2023 at 20:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.