Jenkins正在显示启动chromedriver的消息,但未触发chromedriver并且测试用例失败。我不知道为什么会发生
注意:为此代码创建的xml在终端上成功运行。我认为问题是chromedriver
硒代码:
public class cmddd {
@Test
public void f() throws InterruptedException {
System.setProperty("webdriver.chrome.driver", "/home/dev2/Downloads/newchromedriver/chromedriver");
WebDriver m = new ChromeDriver();
m.get("https://www.google.com/");
System.out.println("passed");
}
}
JENKINS OUTPUT:
Building in workspace /home/dev2/eclipse-workspace/seffcon
[seffcon] $ /bin/sh -xe /tmp/jenkins170843147783066328.sh
+ ./cd.sh
[TestNG] Running:
/home/dev2/eclipse-workspace/seffcon/cd.xml
Starting ChromeDriver 2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7) on port 20671
Only local connections are allowed.
===============================================
Suite
Total tests run: 1, Failures: 1, Skips: 0
===============================================
Build step 'Execute shell' marked build as failure
Finished: FAILURE
答案 0 :(得分:1)
此错误消息...
Starting ChromeDriver 2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7) on port 20671
Only local connections are allowed.
.
Build step 'Execute shell' marked build as failure
Finished: FAILURE
...表示 ChromeDriver 无法启动/产生新的 WebBrowser ,即 Chrome浏览器会话。
您的主要问题是所使用的二进制版本之间的不兼容性:
支持 Chrome v66-68
@Test
。driver.quit()
方法内调用tearDown(){}
,以优雅地关闭和销毁 WebDriver 和 Web Client 实例。答案 1 :(得分:-1)
检查您的chromedriver版本和chromebrowser版本。当版本不匹配时,我已经注意到这种现象。