无法找到 CDP 版本 109 的精确匹配,因此返回找到的最接近版本:使用 Selenium 4x ChromeDriver 109 的无操作实现。

7

我正在尝试执行一个基本的Selenium Java程序:

public static void main(String[] args)
{
    System.setProperty("webdriver.chrome.driver", "C:\\BrowserDrivers\\chromedriver.exe");
    WebDriver driver = new ChromeDriver();
    driver.quit();
}

以下是配置:

  • Selenium 4.x
  • Chrome 版本号为109.0.5414.75(官方版本) (64位) (Win 10)
  • ChromeDriver 109.0.5414.25

ChromeDriver:

ChromeDriver_starting

虽然Chrome和ChromeDriver都是109.x版本,程序仍能成功执行,但我在控制台上看到了一些警告信息,如下所示:

Starting ChromeDriver 109.0.5414.25 (771113d280dd3dda2fb422a6c805f0eb2b8ee6ed-refs/branch-heads/5414@{#303}) on port 57273
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
Jan 14, 2023 3:10:47 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected upstream dialect: W3C
Jan 14, 2023 3:10:47 AM org.openqa.selenium.devtools.CdpVersionFinder findNearestMatch
WARNING: Unable to find an exact match for CDP version 109, so returning the closest version found: a no-op implementation
Jan 14, 2023 3:10:47 AM org.openqa.selenium.devtools.CdpVersionFinder findNearestMatch
INFO: Unable to find CDP implementation matching 109.
Jan 14, 2023 3:10:47 AM org.openqa.selenium.chromium.ChromiumDriver lambda$new$3
WARNING: Unable to find version of CDP to use for . You may need to include a dependency on a specific version of the CDP using something similar to `org.seleniumhq.selenium:selenium-devtools-v86:4.3.0` where the version ("v86") matches the version of the chromium-based browser you're using and the version number of the artifact is the same as Selenium's.

有人可以帮助我理解这些警告背后的问题吗:

WARNING: Unable to find an exact match for CDP version 109, so returning the closest version found: a no-op implementation

并且

WARNING: Unable to find version of CDP to use for . You may need to include a dependency on a specific version of the CDP using something similar to `org.seleniumhq.selenium:selenium-devtools-v86:4.3.0` where the version ("v86") matches the version of the chromium-based browser you're using and the version number of the artifact is the same as Selenium's.
2个回答

5
这是因为'Selenium Dev-Tools'的兼容版本尚未发布。最新的'Selenium Dev-Tools'版本是v108,与Chrome版本V108兼容。
您可以参考以下存储库获取所有Selenium Dev-Tools版本: https://repo1.maven.org/maven2/org/seleniumhq/selenium/ 我使用Selenium v4.7.2Chrome Version 109.0.5414.75Chromedriver v109.0.5414.74进行了检查,得到了下面的警告: enter image description here 然后我降级Chrome浏览器到v108.0.5359.126,使用Selenium v4.7.2ChromeDriver v108.0.5359.71进行了检查,这次没有收到警告: enter image description here 下一个Selenium Dev-Tools版本可能在下一个Selenium升级中发布。
您也可以从Maven存储库单独安装Selenium Dev-Tools:https://mvnrepository.com/search?q=Selenium+DevTools+V108 无论如何,这只是一个警告。

2

CDP

随着Selenium v4.0.0.0-alpha-1的推出,通过“DevTools”接口实现了对CDP的基本支持。从v4.0.0-alpha-4开始,Chrome调试协议命令现在与最新的CDP规范相一致。


这个用例的英文原文是:

This usecase

由于您正在使用ChromeDriver/GoogleChrome版本109.0,最近在Selenium v4.8.0中添加了对它的支持:

v4.8.0
======
* Supported CDP versions: 85, 107, 108, 109

如果有人尝试使用ChromeDriver/GoogleChrome组合v109.0Selenium v4.7.2或更早版本,则Selenium将无法找到CDP版本109的精确匹配,并返回找到的最接近版本,即108
因此会出现以下警告:

警告:无法找到CDP版本109的精确匹配,因此返回找到的最接近版本


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接