此版本Chrome驱动只支持Chrome版本99 当前浏览器版本为98.0.4758.102

This version of ChromeDriver only supports Chrome version 99 Current browser version is 98.0.4758.102

我当前的 chrome 版本:98.0.4758.102

我当前的selenium版本:4.1.1无法下载chrome99。我的 chrome 98 已经更新到最新版本了,如果是 beta 版本,我如何得到 chrome 99

跟踪日志:

ChromeDriver was started successfully.
Starting ChromeDriver 99.0.4844.51 (d537ec02474b5afe23684e7963d538896c63ac77-refs/branch-heads/4844@{#875}) on port 59895
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 "Thread-4" 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 99
Current browser version is 98.0.4758.102 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe
Build info: version: '4.1.1', revision: 'e8fcc2cecf'
System info: host: 'L-QLT-005', ip: '10.1.1.2', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.2'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [--start-maximized, --disable-extensions, --incognito, --disable-popup-blocking, --no-sandbox, --ignore-certificate-errors], extensions: []}}], desiredCapabilities=Capabilities {browserName: chrome, goog:chromeOptions: {args: [--start-maximized, --disable-extensions, --incognito, --disable-popup-blocking, --no-sandbox, --ignore-certificate-errors], extensions: []}}}]
    at org.seleniumhq.selenium.remote_driver/org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
    at org.seleniumhq.selenium.remote_driver/org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:84)
    at org.seleniumhq.selenium.remote_driver/org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:62)
    at org.seleniumhq.selenium.remote_driver/org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156)
    at org.seleniumhq.selenium.remote_driver/org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:167)
    at org.seleniumhq.selenium.remote_driver/org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:142)
    at org.seleniumhq.selenium.remote_driver/org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
    at org.seleniumhq.selenium.remote_driver/org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:230)
    at org.seleniumhq.selenium.remote_driver/org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:151)
    at org.seleniumhq.selenium.chromium_driver/org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:108)
    at org.seleniumhq.selenium.chrome_driver/org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:104)
    at org.seleniumhq.selenium.chrome_driver/org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:91)
    at org.seleniumhq.selenium.chrome_driver/org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:80)
    at io.beyn.spell/io.beyn.spell.Library.startBrowserChecker(Library.java:58)
    at io.beyn.spell/io.beyn.spell.FXMLDocumentController.lambda$Event(FXMLDocumentController.java:188)

Starting ChromeDriver 99.0.4844.51

Current browser version is 98.0.4758.102

你的chrome驱动是chrome版本的,还没有出来。您有几种解决方案:

  • 您可以从here下载实际的Chrome驱动程序98.0.4758.102并使用它。

  • 您可以下载Chrome Beta(目前为99.0.4844.51)或Chrome Dev(当前为 100.0.4896.12),您可以在其中访问较新的版本。

  • 如果您使用 WebDriverManager 来自 io.github.bonigarcia,您必须正确设置 browserVersion 和 driverVersion:

    WebDriverManager.chromedriver().browserVersion("98.0.4758.102").setup();
    WebDriverManager.chromedriver().driverVersion("98.0.4758.102").setup();
    

这个错误信息...

Starting ChromeDriver 99.0.4844.51 (d537ec02474b5afe23684e7963d538896c63ac77-refs/branch-heads/4844@{#875}) on port 59895
.
Exception in thread "Thread-4" 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 99
Current browser version is 98.0.4758.102 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe

...表示 was unable to initiate/spawn a new Browsing Context i.e. 会话。

您的主要问题是您使用的二进制文件版本之间不兼容,如下所示:

  • 您正在使用 chrome=98.0
  • ChromeDriver v98.0 的发行说明清楚地提到了以下内容:

Supports Chrome version 98

  • 但是你使用的是chromedriver=99.0
  • chromedriver=99.0 的发行说明清楚地提到了以下内容:

Supports Chrome version 99

所以 chromedriver=91.0chrome=96.0.4664.45[=52= 之间存在明显的不匹配]


解决方案

确保: