Selenium Chromedriver: Unable to find an exact match for CDP version 98, so returning the closest version found: 97

Viewed 9694

Im trying to get Selenium working with Java. I'm using Maven. My pom.xml file looks like this

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

When i try to run my programm the following error shows up. Chrome starts but does not open any sites. Ive tried chrome webdriver version 98 97 and 96. Does my normal chrome version matter?

Starting ChromeDriver 97.0.4692.71 (adefa7837d02a07a604c1e6eff0b3a09422ab88d-refs/branch-heads/4692@{#1247}) on port 61659
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
[1644353402.048][WARNING]: This version of ChromeDriver has not been tested with Chrome version 98.
Feb. 08, 2022 9:50:02 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Feb. 08, 2022 9:50:02 PM org.openqa.selenium.devtools.CdpVersionFinder findNearestMatch
WARNING: Unable to find an exact match for CDP version 98, so returning the closest version found: 97
Feb. 08, 2022 9:50:02 PM org.openqa.selenium.devtools.CdpVersionFinder findNearestMatch
INFO: Found CDP implementation for version 98 of 97
3 Answers

This error message...

[1644353402.048][WARNING]: This version of ChromeDriver has not been tested with Chrome version 98.
Feb. 08, 2022 9:50:02 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Feb. 08, 2022 9:50:02 PM org.openqa.selenium.devtools.CdpVersionFinder findNearestMatch
WARNING: Unable to find an exact match for CDP version 98, so returning the closest version found: 97
Feb. 08, 2022 9:50:02 PM org.openqa.selenium.devtools.CdpVersionFinder findNearestMatch
INFO: Found CDP implementation for version 98 of 97

...implies that the ChromeDriver was unable to initiate/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=98
  • Release Notes of ChromeDriver v98.0 clearly mentions the following:

Supports Chrome version 98

Supports Chrome version 97

So there is a clear mismatch between chromedriver=97.0 and the chrome=98.0


Solution

Ensure that:

Sadly, Selenium 4.1.2 doesnt support v98 yet. Here is the changelog:

v4.1.2

  • Supported CDP versions: 85, 95, 96, 97
  • Add new desktop cast command for Chromium
  • ...

This doesnt mean though that it wont work, in my case, it works perfectly. But yeah you may experience some stuff not working.

Adding this dependency fixed the issue for me:

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-devtools-v97</artifactId>
    <version>4.1.2</version>
</dependency>

Keep in mind Chrome update or selenium java update might require version update of the dependency too.

Related