WebDriverManager Causing Mismatch ChromeDriver for Chrome Browser version 116.0.5845.111 - (Selenium version - 3.141.59)
Asked Answered
S

4

5

Exception:

org.openqa.selenium.SessionNotCreatedException: session not created: This version of ChromeDriver only supports Chrome version 114
Current browser version is 116.0.5845.111 with binary path  

pom.xml

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

<dependency>
  <groupId>io.github.bonigarcia</groupId>
  <artifactId>webdrivermanager</artifactId>
  <version>3.7.1</version>
</dependency> 

Code for setting up the ChromeOptions and finally creating the webdriver:


WebDriverManager.chromedriver().setup();
ChromeOptions options = new ChromeOptions();
options.addArguments("--no-sandbox");
options.addArguments("--test-type");
options.addArguments("--start-maximized");
if (setBrowserUI().equals("yes")) {
  options.addArguments("--headless");
}
options.addArguments("Browser.setDownloadBehavior", "allow");
options.addArguments("--disable-extensions");
options.addArguments("--disable-dev-shm-usage");
options.setExperimentalOption("prefs", chromePrefs);
base.driver = new ChromeDriver(options); 

Project restriction prevent the upgrade of the Selenium version used. Is there any other way to solve other than updating to Selenium version 4.x ?

Sivas answered 24/8, 2023 at 15:2 Comment(5)
Refer this answer - https://mcmap.net/q/67697/-response-code-500-message-session-not-created-this-version-of-chromedriver-only-supports-chrome-version-114Microscope
I know they asked to upgrade the selenium version to 4.x but here my problem is I can't upgrade the selenium version. Have any solution for itSivas
Upgrade webdrivermanager to v5.4.1 and see if it works.Microscope
still no luck , facing same errorSivas
Check my answer, try that out.Microscope
M
3

Simple solution will be to upgrade selenium to v4.11.0 as this version's SeleniumManager tool is compatible with chrome version 116.

Since you do not wish to upgrade selenium, download the 116 version of chromedriver and try to set the path of chromedriver.exe manually using System.setProperty. Refer the code below:

public static void main(String[] args) {    
    System.setProperty("webdriver.chrome.driver", "C:/<full path>/chromedriver.exe");
    WebDriver driver = new ChromeDriver();
    driver.get("https://www.google.com");        
    System.out.println(driver.getTitle());
}

Link to download latest chromedriver - https://googlechromelabs.github.io/chrome-for-testing/

Microscope answered 25/8, 2023 at 12:40 Comment(0)
W
3

From Google Chrome v115 onwards, the chromedriver is now available from the new Chrome for Testing JSON endpoints. See the announcement here: ChromeDriver - Version Selection

Version 3.7.1 of io.github.bonigarcia.WebDriverManager does not cater for that new endpoint, so provides the project with the latest chromedriver from the old repository (hence version 114)

WebDriverManager catered for this change from version 5.5.0 (latest version at time of publishing this answer is 5.5.2) - see here:

Update the dependency in the pom.xml:

<dependency>
  <groupId>io.github.bonigarcia</groupId>
  <artifactId>webdrivermanager</artifactId>
  <version>5.5.2</version>
</dependency> 
Wellfixed answered 29/8, 2023 at 7:42 Comment(0)
V
0

I had this issue and swtiched to Geckodriver with Firefox. Geckodriver has never needed to be upgraded in 2 years, unlike the every 2 months with Chrone!

Vinni answered 25/8, 2023 at 12:45 Comment(0)
M
0

Simply use this dependency in your maven pom

<dependencies>
    <!--Basic Dependencies-->


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

    <!--
    https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->
    <dependency>
        <groupId>io.github.bonigarcia</groupId>
        <artifactId>webdrivermanager</artifactId>
        <version>5.5.3</version>
    </dependency>

    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>31.0.1-jre</version>
    </dependency>


    <!-- https://mvnrepository.com/artifact/org.testng/testng -->
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>7.4.0</version>
        <scope>test</scope>
    </dependency>


</dependencies>
Motherwell answered 12/4 at 14:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.