Jenkins:管道错误-找不到Chrome二进制文件

vwhgwdsa  于 2022-10-06  发布在  Jenkins
关注(0)|答案(1)|浏览(187)

我在Jenkins(CentOS服务器)上创建了一个管道,并尝试运行Selify测试(命令:MVN CLEAN INSTALL),但在Jenkin上的构建阶段显示以下错误:

Running mu.automate.TestCaseService
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 106.0.5249.21 (71f4e2c9a6f38f5550a8ea29a984a08304554956-refs/branch-heads/5249@{#228}) on port 40216
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
Tests run: 3, Failures: 2, Errors: 0, Skipped: 1, Time elapsed: 1.243 sec <<< FAILURE!

Results :

Failed tests:   setUp(dummy.automate.TestCaseService): Could not start a new session. Response code 500. Message: unknown error: cannot find Chrome binary
  tearDown(dummy.automate.TestCaseService)

Tests run: 3, Failures: 2, Errors: 0, Skipped: 1

我已从以下链接下载了最新的驱动程序:

https://chromedriver.chromium.org/downloads

我已经在安装Jenkins的Centos服务器上的路径上添加了驱动程序,如下所示:

/opt/chromedriver

然后在代码中为驱动程序加载测试,如下所示:

System.setProperty("webdriver.chrome.driver",
                "/opt/chromedriver");

根据在线资源,它看起来像是驱动程序和浏览器之间的不兼容问题,但我不知道如何检查它。

有谁能指出我做错了什么吗?

v9tzhpje

v9tzhpje1#

我设法通过在我的CentOS上安装Chrome来解决这个问题。请找到下面的安装链接:

link

把它贴出来,以防其他人遇到这个问题。

相关问题