3
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  
<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 chrome Options 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); 

Can't update the selenium version. Is there anyother way to solve other than updating seleinum version 4.x ?

Shawn
  • 4,064
  • 2
  • 11
  • 23

3 Answers3

1

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/

Shawn
  • 4,064
  • 2
  • 11
  • 23
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!

0

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)

WedriverManager 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> 
djmonki
  • 3,020
  • 7
  • 18