【发布时间】:2019-03-26 14:24:31
【问题描述】:
我正在尝试在Jenkins 中开始工作,它执行Selenium 脚本。几个月前它运行良好,但今天由于未知原因停止运行。这项工作一如既往地开始第一次测试,然后卡住了。我没有收到任何错误,之后什么也没有发生:
TEST STARTED: test
-------------------------------------------------------------------
[main] INFO net.serenitybdd.core.Serenity - TEST NUMBER: 1
März 26, 2019 3:02:23 NACHM. org.openqa.selenium.remote.DesiredCapabilities chrome
INFO: Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
Starting ChromeDriver 73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72) on port 46182
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
März 26, 2019 3:02:25 NACHM. org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
我已经意识到,每次我使用 chrome 开始工作时,都会在任务管理器中添加一个新的 Google Chrome 进程,所以我假设 chrome 窗口正在显示。另外,当我杀死这个进程时,我得到了这个:
...
[1553694146.113][SEVERE]: Timed out receiving message from renderer: 10.000
[1553694146.113][WARNING]: screenshot failed, retrying
[1553694156.113][SEVERE]: Timed out receiving message from renderer: 10.000
[1553694166.118][SEVERE]: Timed out receiving message from renderer: 10.000
[1553694166.118][WARNING]: screenshot failed, retrying
[main] WARN net.thucydides.core.webdriver.WebDriverFacade - Failed to take screenshot (unknown error: session deleted because of page crash
from unknown error: cannot determine loading status
from tab crashed
(Session info: chrome=73.0.3683.86)
(Driver info: chromedriver=73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),platform=Windows NT 10.0.17763 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'DESKTOP-5QTQGUC', ip: '192.168.178.23', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.1'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities {acceptInsecureCerts: false, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 73.0.3683.68 (47787ec04b6e3..., userDataDir: C:\WINDOWS\TEMP\scoped_dir5...}, cssSelectorsEnabled: true, databaseEnabled: false, goog:chromeOptions: {debuggerAddress: localhost:3697}, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, proxy: Proxy(), rotatable: false, setWindowRect: true, strictFileInteractability: false, takesHeapSnapshot: true, takesScreenshot: true, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unexpectedAlertBehaviour: ignore, unhandledPromptBehavior: ignore, version: 73.0.3683.86, webStorageEnabled: true}
Session ID: da5e7153b21e4cb075843ac4e541ab6f)
[main] ERROR net.thucydides.core.steps.ConsoleLoggingListener -
...
我已尝试更新Jenkins 和所有插件,更新了我的浏览器和网络驱动程序,关闭了防火墙和防病毒软件。到目前为止没有任何帮助。我仍然能够通过 ide 在本地运行所有测试,但不知道 Jenkins 出了什么问题,我无法运行我的测试。
任何想法,可能出了什么问题以及如何处理?
PS 它在 Firefox 中运行良好,但我也需要 chrome
【问题讨论】:
-
它是前一段时间了,但是.. 检查您是否在系统上留下了 chrome 驱动程序的意外实例.. 在我的情况下,我正在使用 selenium 进行大规模测试,问题是我的脚本留下了很多chrome驱动程序的死实例..即使我试图回收chromedriver实例..在我的情况下,唯一的解决方案是解决这个问题,而且在我看来,异步运行selenium测试非常困难,我只是想指出。希望它能给你带来一些有用的信息。干杯
-
几件事 1) 我们能否请您查看错误提到的代码,您在哪里使用
DesiredCapabilities.chrome()。这将有助于了解它是如何启动的。 2) 直接启动 selenium 驱动程序,查看出现的命令提示符是否保持可见并且不会出现任何类型的错误。 3)你已经重新启动了这台机器,对吧? 4) 打开 Jenkins 时,您在网络浏览器上看到的只是ERR_CONNECTION_REFUSED,仅此而已,就像纯文本一样? -
@Asyranok 1) 如果您的意思是
ERR_CONNECTION_REFUSED,当我尝试打开Jenkins网页时,就会发生这种情况。我认为这与DesiredCapabilities.chrome()无关。 2)我已经启动了。没有错误。 3)是的,我已经重新启动了。 4)完整的消息是这样的(The website is unavailable localhost has refused the connection. Try the following: Check connection Check Proxy and Firewall ERR_CONNECTION_REFUSED) -
我使用的是 Firefox 98.0.1(64 位),我从 Jenkins 构建调用的硒测试没有启动浏览器。 Chrome 上的行为相同。所有测试都通过了,maven surefire 插件报告非常好。我觉得这与 Jenkins 推出无头浏览器有关。
标签: java selenium google-chrome jenkins selenium-webdriver