Languages

Selenium java - How to solve selenium error SessionNotCreatedException: session not created: This version of ChromeDriver only supports Chrome version ?

8 points
Asked by:
Joann-Calderon
383

How to solve selenium error SessionNotCreatedException: session not created: This version of ChromeDriver only supports Chrome version ?

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: session not created: This version of ChromeDriver only supports Chrome version 101

Part of stacktrace:

Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: session not created: This version of ChromeDriver only supports Chrome version 101
Current browser version is 100.0.4896.127 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe

 

1 answer
2 points
Answered by:
Joann-Calderon
383

You have wrong version of the chrome driver. Chrome browser and chrome driver needs to have the same version.

Your current setup:

  • You have chrome browser version: 100.0.4896.127
  • Chrome driver: 101

Chrove driver needs to be in version: 100

Solution

Download chrome driver in version 100.

Link:

 

Steps to download chrome driver:

1. Current Releases

Current Releases


2. If you use windows:

Chrome driver for windows (win32.zip)
Chrome driver for windows (win32.zip)


3. Download correct version of the chrome driver.

4. Unzip the package

5. Replace your local chrome.exe with this newly downloaded chrome driver.

In below example the path to the chrome driver is:

C:\\selenium_chrome_drivers\\chromedriver.exe

Example:

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

public class Example {

    public static void main(String[] args) {
        ChromeOptions options = new ChromeOptions();
        options.addArguments("--window-size=1366,768");

        String chromeDriverPath = "C:\\selenium_chrome_drivers\\chromedriver.exe";
        System.setProperty("webdriver.chrome.driver", chromeDriverPath);
        WebDriver webDriver = new ChromeDriver(options);

        try {
            String filePath = "https://en.wikipedia.org/wiki/Java_(programming_language)";
            webDriver.get(filePath);

            WebElement element = webDriver.findElement(By.id("firstHeading"));
            System.out.println(element.getText()); // Java (programming language)
        } finally {
            webDriver.close();
            webDriver.quit();
        }
    }
}

 

0 comments Add comment
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join