2

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
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Nico1300
  • 105
  • 1
  • 1
  • 9
  • Your machine has Chrome browser version 98 while chromeDriver.exe being used in project is for 97. Go to chromedriver.exe download page & replace existing chromedriver.exe file & try running your code. – A B Feb 14 '22 at 03:47

3 Answers3

3

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.

2

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:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • 1
    selenium 4.1.2 doesn't contain version 98 for now. So I get still the error "Unable to find an exact match for CDP version 98, so returning the closest version found: 97" – Harald Brabenetz Feb 09 '22 at 19:22
  • is this true? My Chrome is on latest version and my chromedriver also, selenium is on 4.1.2 and i still get the missmatch error. Does Selenium 4.1.2 only support 97? is there a way to downgrade chrome? – Nico1300 Feb 09 '22 at 19:54
  • @Nico1300 no you cant downgrade. You need to download old portable version, so it will not autoupdate. https://sourceforge.net/projects/portableapps/files/Google%20Chrome%20Portable/ – SVK PETO Feb 21 '22 at 13:00
0

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.

bonislav
  • 13
  • 3