org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. (mismatch versions)

736 Views Asked by At

Language - Java

pom.xml dependencies- bonigarcia 5.4.1

selenium-java-4.10.0

Error:

Caused by: 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 121.0.6167.184 with binary path /Applications/Google Chrome.app/Contents/MacOS/Google Chrome 

I ran my tests in the morning, and all was ok. 10 min after -all fails. No changes were made.

Updated version of dependencies to bonigarcia 5.6.3 selenium-java-4.16.1 still same error. Made sure that WEbdriverManager downloaded needed version of Chrome driver properly, and located it successfully. Due to company policies not able to downgrade to lower version of chrome browser. What can be the issue?

3

There are 3 best solutions below

0
Alexandre Ferreira On

I had this issue too. It seems that for some reason it failed to download the correct version of the driver and resolved, wrongly, that the correct version would be 114.0.5735.90.

    2024-02-17T08:45:08.071Z  INFO 90678 --- [Pool-1-worker-1] i.g.bonigarcia.wdm.WebDriverManager      : Using chromedriver 121.0.6167.184 (resolved driver for Chrome 121)
    2024-02-17T08:45:08.096Z  INFO 90678 --- [Pool-1-worker-1] i.g.bonigarcia.wdm.WebDriverManager      : Reading https://chromedriver.storage.googleapis.com/ to seek chromedriver
    2024-02-17T08:45:08.694Z  INFO 90678 --- [Pool-1-worker-1] i.g.bonigarcia.wdm.online.Downloader     : Downloading https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/121.0.6167.184/mac-arm64/chromedriver-mac-arm64.zip
    2024-02-17T08:45:08.889Z ERROR 90678 --- [Pool-1-worker-1] i.g.bonigarcia.wdm.online.HttpClient     : Error HTTP 404 executing https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/121.0.6167.184/mac-arm64/chromedriver-mac-arm64.zip
    2024-02-17T08:45:08.890Z  INFO 90678 --- [Pool-1-worker-1] i.g.b.wdm.cache.ResolutionCache          : Clearing WebDriverManager resolution cache
    2024-02-17T08:45:08.897Z  WARN 90678 --- [Pool-1-worker-1] i.g.bonigarcia.wdm.WebDriverManager      : There was an error managing chromedriver 121.0.6167.184 (Error HTTP 404 executing https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/121.0.6167.184/mac-arm64/chromedriver-mac-arm64.zip) ... trying again avoiding reading release from repository
    2024-02-17T08:45:09.142Z  INFO 90678 --- [Pool-1-worker-1] i.g.bonigarcia.wdm.WebDriverManager      : Reading https://chromedriver.storage.googleapis.com/ to seek chromedriver
    2024-02-17T08:45:09.729Z  INFO 90678 --- [Pool-1-worker-1] i.g.bonigarcia.wdm.WebDriverManager      : Exporting webdriver.chrome.driver as /Users/motarube/.cache/selenium/chromedriver/mac-arm64/114.0.5735.90/chromedriver
    2024-02-17T08:45:13.274Z  INFO 90678 --- [Pool-1-worker-1] i.g.bonigarcia.wdm.WebDriverManager      : Using chromedriver 114.0.5735.90 (resolved driver for Chrome 121)
    2024-02-17T08:45:13.279Z  INFO 90678 --- [Pool-1-worker-1] i.g.bonigarcia.wdm.WebDriverManager      : Exporting webdriver.chrome.driver as /Users/motarube/.cache/selenium/chromedriver/mac-arm64/114.0.5735.90/chromedriver

Solution:

In /Users/YOUR_USER/.cache/selenium, first delete the chromedriver folder, then edit the file resolution.properties

Mine was looking like this:

    #WebDriverManager Resolution Cache
    #Sat Feb 17 08:45:09 WET 2024
    chrome=121
    chrome-ttl=09\:45\:09 17/02/2024 WET
    chrome121=114.0.5735.90
    chrome121-ttl=08\:45\:09 18/02/2024 WET

Change to the latest chromedriver version according to: https://googlechromelabs.github.io/chrome-for-testing/

It should look like this:

    #WebDriverManager Resolution Cache
    #Sat Feb 17 08:45:09 WET 2024
    chrome=121
    chrome-ttl=09\:45\:09 17/02/2024 WET
    chrome121=121.0.6167.184
    chrome121-ttl=08\:45\:09 18/02/2024 WET

I then retried to run my tests, and the webdriver manager now downloads the correct version and uses it for tests.

0
Sreeteja Rusum On

I was able to fix this problem. The problem over here is The chromedriver team has stopped publishing the chromedriver releases and metadata using their traditional chromedriver download repository with chromedriver 114. This way, as of chromedriver 115, the chromedriver releases can only be discovered programmatically using the Chrome for Testing (CfT) JSON endpoints.

This change is very relevant for WebDriverManager, since, as of Chrome 115 and 116, chromedriver cannot be managed automatically by WebDriverManager using the traditional way. Therefore, for older versions of WebDriverManager, this situation led to errors like the following:

io.github.bonigarcia.wdm.online.HttpClient: Error HTTP 404 executing https://chromedriver.storage.googleapis.com/LATEST_RELEASE_116 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 WebDriverManager 5.4+ implements the support for the CfT endpoints. Therefore, the solution to this problem is to bump WebDriverManager to the latest version (5.6.3 currently). Also, to ensure that the wrong version has not been cached in the resolution cache, you can refresh completely the cache folder (at least once) as follows:

WebDriverManager.chromedriver().clearDriverCache().setup();

0
Midhun On

Delete the .cache folder from C->Users->{Username}. Upgrade the WebDriverManager to the latest and rerun the tests.