在jenkins上运行selenium测试时出现NoSuchSession异常

时间:2017-12-07 17:05:24

标签: java maven selenium exception jenkins

[ERROR] Tests run: 33, Failures: 32, Errors: 0, Skipped: 1, Time elapsed: 65.649 s <<< FAILURE! - in TestSuite
[ERROR] testHomeWidgetValidData(test.desktop.HomePageTest)  Time elapsed: 0.454 s  <<< FAILURE!
org.openqa.selenium.NoSuchSessionException: 
no such session
  (Driver info: chromedriver=2.33.506092 (733a02544d189eeb751fe0d7ddca79a0ee28cce4),platform=Linux 4.10.0-40-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 4 milliseconds
Build info: version: '3.0.0', revision: '350cf60', time: '2016-10-13 10:48:57 -0700'
System info: host: 'hp', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.10.0-40-generic', java.version: '1.8.0_152'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{message=unknown error: Chrome failed to start: exited abnormally
  (Driver info: chromedriver=2.33.506092 (733a02544d189eeb751fe0d7ddca79a0ee28cce4),platform=Linux 4.10.0-40-generic x86_64), platform=ANY}]
Session ID: 944b193854ef4f0fb75de599eb1d5610

我遇到了在jenkins上运行selenium测试的问题。所以在IDE中一切正常并且编译没有任何问题。我不知道问题的根源是什么。我使用WebDriverManager作为驱动程序实现。 stacktrace也会在错误消息上面显示警告:

[WARNING] 
[WARNING] Some problems were encountered while building the effective model for GLIC-test:webdriver:jar:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for io.qameta.allure:allure-maven is missing. @ line 78, column 21
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 

1 个答案:

答案 0 :(得分:-1)

我们需要做任何特定的设置,以便在Jenkins中运行headless,因为Selenium测试失败后再点击运行Jenkins的第一个元素,尽管它在我的本地系统中运行正常。