java.lang.IllegalStateException:

单击构建时,我在Jenkins 控制台中收到以下错误。但是,当我在 intelij IDE 中运行测试时,它运行没有任何故障。是Jenkins的这个问题还是chromedriver.exe的路径问题


[INFO]  T E S T S

[INFO] -------------------------------------------------------

[INFO] Running TestSuite

[ERROR] Tests run: 38, Failures: 1, Errors: 0, Skipped: 37, Time elapsed: 2.237 s <<< FAILURE! - in TestSuite

[ERROR] SetUp(com.ancon.automation.tests.TenantsTest)  Time elapsed: 1.593 s  **<<< FAILURE!

java.lang.IllegalStateException: The driver executable does not exist: /var/lib/jenkins/jobs/Ancon-Automation/workspace\src\main\java\com\ancon\automation\webDriver\chromedriver.exe**

    at com.ancon.automation.tests.TenantsTest.SetUp(TenantsTest.java:62)


[INFO] 

[INFO] Results:

[INFO] 

[ERROR] Failures: 

[ERROR]   TenantsTest.SetUp:62 » IllegalState The driver executable does not exist: /var...

[INFO] 

[ERROR] Tests run: 16, Failures: 1, Errors: 0, Skipped: 15

[INFO] 

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 14.616 s

[INFO] Finished at: 2018-08-17T09:56:58+05:30

[INFO] ------------------------------------------------------------------------

**[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test (default-test) on project Ancon: There are test failures.

[ERROR]** 

[ERROR] Please refer to /var/lib/jenkins/jobs/Ancon-Automation/workspace/target/surefire-reports for the individual test results.

[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.

[ERROR] -> [Help 1]

[ERROR] 

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.


注意:我发现了类似的问题,但找不到正确的答案。


叮当猫咪
浏览 363回答 3
3回答

芜湖不芜

这个错误信息...java.lang.IllegalStateException: The driver executable does not exist: /var/lib/jenkins/jobs/Ancon-Automation/workspace\src\main\java\com\ancon\automation\webDriver\chromedriver.exe...暗示JVM无法在指定位置找到 ChromeDriver二进制文件。你的主要问题似乎到查询股价的OS path.separator的有效绝对路径内ChromeDriver。目前解析的有效绝对路径为:/var/lib/jenkins/jobs/Ancon-Automation/workspace\src\main\java\com\ancon\automation\webDriver\chromedriver.exe您需要使用该/字符作为path.separator,因此您的ChromeDriver 的有效绝对路径变为:Linux 风格(剥离.exe部分):/var/lib/jenkins/jobs/Ancon-Automation/workspace/src/main/java/com/ancon/automation/webDriver/chromedriver窗户样式(含.exe部分):/var/lib/jenkins/jobs/Ancon-Automation/workspace/src/main/java/com/ancon/automation/webDriver/chromedriver.exe

翻翻过去那场雪

请使用代码中的相对路径来设置驱动程序属性,如下所示System.setProperty("webdriver.chrome.driver",&nbsp;"src/main/java/com/ancon/automation/webDriver/chromedriver.exe");

至尊宝的传说

使用 path 看起来您是在 linux 机器上运行测试,或者至少代码期望您在 linux 机器上可执行。因为它是一个愚蠢的错误use .exe extension on a linux box,你应该忽略它。此外,您应该仅在代码中处理此类情况,因为它会导致跨操作系统执行中出现令人沮丧的问题。希望它之后有效removing .exe part。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java