操作系统:
Linux
Selenium 版本:
3.1.0
浏览器:
谷歌浏览器
尝试在 Jenkins 上运行 selenium 代码会出现以下问题:
Starting ChromeDriver 2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57) on port 21812
Only local connections are allowed.
Sep 27, 2017 2:31:27 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Starting ChromeDriver 2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57) on port 29075
Only local connections are allowed.
Sep 27, 2017 2:32:28 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Starting ChromeDriver 2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57) on port 6967
Only local connections are allowed.
Sep 27, 2017 2:33:28 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Starting ChromeDriver 2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57) on port 31312
Only local connections are allowed.
Sep 27, 2017 2:34:28 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
[ERROR] Tests run: 26, Failures: 4, Errors: 0, Skipped: 22, Time elapsed: 242.653 s <<< FAILURE! - in TestSuite
[ERROR] setUp(BrkProducts.LoginTest) Time elapsed: 62.029 s <<< FAILURE!
org.openqa.selenium.NoSuchSessionException:
no such session
(Driver info: chromedriver=2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57),platform=Linux 3.10.0-327.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 14 milliseconds
Build info: version: '3.1.0', revision: 'b94c902', time: '2017-02-16 12:21:31 -0800'
System info: host: 'xyz.com', ip: '10.4.124.176', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-327.el7.x86_64', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{message=unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57),platform=Linux 3.10.0-327.el7.x86_64 x86_64), platform=ANY}]
Session ID: 0e4c67c28f18b452df9f0d3916aba043
at BrkProducts.LoginTest.setUp(LoginTest.java:19)
然后,它会跳过该类中的所有后续测试。接下来是:
[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR] BrkProducts.ButtonTest.setUp(BrkProducts.ButtonTest)
[ERROR] Run 1: ButtonTest.setUp:23->Methods.setup:135 » NoSuchSession no such session
(Driv...
[INFO] Run 2: PASS
[INFO]
进程变得不稳定:
Please refer to /var/lib/jenkins/workspace/SmokeTest/target/surefire-reports for the individual test results.
Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
[JENKINS] Recording test results
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:14 min
[INFO] Finished at: 2017-09-27T14:34:32-04:00
[INFO] Final Memory: 29M/276M
[INFO] ------------------------------------------------------------------------
[JENKINS] Archiving /var/lib/jenkins/workspace/SmokeTest/pom.xml to com.enso.automation/TestingAutomation/1.0-SNAPSHOT/TestingAutomation-1.0-SNAPSHOT.pom
channel stopped
Finished: UNSTABLE
经过所有研究,感觉该网站实际上并未在此处加载。不确定 Jenkins 中发生了什么。
非常感谢这里的任何帮助。谢谢
最佳答案
您的 Linux 服务器中的 Chrome 版本是多少?根据您的评论,我了解到它适用于您的 Windows 机器。您可以安装与 Windows 中相同版本的 Chrome。无论如何在这个链接https://sites.google.com/a/chromium.org/chromedriver/downloads有一些关于兼容性的信息。 如果您有最新版本的 Chrome,您可以尝试使用最新版本的 ChromeDriver(现在是 2.32)而不是 2.30
关于java - 尝试在 Jenkins 上运行 Selenium 时出现 NoSuchSession 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46455454/