0

I am sure that my tests are working correctly. When I run the code I got the error in terminal like,

Scenario: User adds new quick work order to employee from website # src/test/java/Features/5NewQuickJobOrder.feature:12
Starting ChromeDriver 111.0.5563.19 (378a38865270d286695aeb86f190564911ef7bc2-refs/branch-heads/5563@{#251}) on port 4290
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: session not created: This version of ChromeDriver only supports Chrome version 111
Current browser version is 110.0.5481.97 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'DESKTOP-CONJ3EC', ip: '192.168.1.27', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '19.0.2'
Driver info: driver.version: ChromeDriver

Recently Chrome updates itself and my version is now 110.0.5481.97. But somehow it tries the run the test with version 111 shows below. I have no version in my computer such that starts with 111..

Scenario: User adds new quick work order to employee from website # src/test/java/Features/5NewQuickJobOrder.feature:12
Starting ChromeDriver 111.0.5563.19 (378a38865270d286695aeb86f190564911ef7bc2-refs/branch-heads/5563@{#251}) on port 40758
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.

I do not use any chromedriver exe in my project folder, I directly use setup and driver intsance.

public static WebDriver initialize_Driver(String browser) {
        properties = ConfigReader.getProperties();

        if (browser.equals("Chrome")) {
            WebDriverManager.chromedriver().setup();
            driver = new ChromeDriver();

        }

@Before
    public void before() {
        String browser = Reporter.getCurrentTestResult().getTestContext().getCurrentXmlTest().getParameter("browser");
        properties = ConfigReader.initialize_Properties();
        driver = DriverCreater.initialize_Driver(browser);
    }

I will be very glad, if you could help me!

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
smooth
  • 1
  • 3

2 Answers2

0

First the solution

To instantiate a specific browser version of ChromeDriver you can use:

WebDriverManager.chromedriver().driverVersion("111.0.5563.19").setup();

Details

This error message...

org.openqa.selenium.SessionNotCreatedException: session not created: This version of ChromeDriver only supports Chrome version 111

...implies that SessionNotCreatedException was raised as ChromeDriver was unable to spawn a new Browsing Context i.e. session.

Your main issue is the incompatibility between the version of the binaries you are using as follows:

  • You are using chrome=110.0.5481.97
  • But you are using chromedriver=111.0.5563.19
  • Release Notes of chromedriver=111.0 clearly mentions the following :

Supports Chrome version 111

So there is a clear mismatch between chromedriver=111.0 and the chrome=110.0


Solution

Ensure that:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • Thank you for your help! Your first solution helped me a lot. But what if chrome updates itself in the next future again? Should I write the version name in driverVersion() method again? – smooth Feb 17 '23 at 06:18
0

I faced the same issue and I fixed it by updating the Selenium-Java version in pom.xml. Hope this helps!

Tarini
  • 1
  • 2
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 29 '23 at 08:03
  • This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://stackoverflow.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://stackoverflow.com/help/whats-reputation), you can also [add a bounty](https://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question. - [From Review](/review/late-answers/34903197) – Yaroslavm Aug 29 '23 at 08:13