You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VPS启动ChromeDriver成功但遇CDP版本匹配警告,请求技术支持

问题现象

在VPS上成功启动ChromeDriver后,执行java -jar demo.jar时出现两类警告,具体输出如下:

$ java -jar demo.jar

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

Starting ChromeDriver 111.0.5563.64 (c710e93d5b63b7095afe8c2c17df34408078439d-refs/branch-heads/5563@{#995}) on port 25982
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.

Mar 22, 2023 8:27:55 PM org.openqa.selenium.devtools.CdpVersionFinder findNearestMatch
WARNING: Unable to find CDP implementation matching 111
Mar 22, 2023 8:27:55 PM 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.8.1` 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.

Starting ChromeDriver 111.0.5563.64 (c710e93d5b63b7095afe8c2c17df34408078439d-refs/branch-heads/5563@{#995}) on port 4625
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.

ChromeDriver was started successfully.

Mar 22, 2023 8:27:56 PM org.openqa.selenium.devtools.CdpVersionFinder findNearestMatch
WARNING: Unable to find CDP implementation matching 111
Mar 22, 2023 8:27:56 PM 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.8.1` 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.

解决方案

1. SLF4J警告处理

该警告是因为项目仅引入了SLF4J日志门面,缺少具体的日志实现依赖。需添加对应日志框架依赖:

  • Maven:在pom.xml中添加Logback实现(常用选项)
<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    <version>1.4.8</version> <!-- 版本可按需调整 -->
</dependency>
  • Gradle:在build.gradle中添加
implementation 'ch.qos.logback:logback-classic:1.4.8'

重新打包demo.jar后运行,警告即可消除。

2. CDP版本不匹配警告处理

警告提示找不到与ChromeDriver 111匹配的CDP(Chrome DevTools Protocol)实现,需添加对应版本的Selenium DevTools依赖:

  1. 确认项目中Selenium核心依赖的版本(比如示例中的4.8.1)
  2. 添加对应v111版本的DevTools依赖,版本号需与Selenium核心版本完全一致:
  • Maven
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-devtools-v111</artifactId>
    <version>4.8.1</version>
</dependency>
  • Gradle
implementation 'org.seleniumhq.selenium:selenium-devtools-v111:4.8.1'

重新打包后,CDP相关警告会消失。


内容的提问来源于stack exchange,提问作者LorenzoCs

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.27 11:17:39