我们的CircleCI测试使用硒,通过selenium-webdriver通过PhantomJS运行UI测试。测试中我们游民ENV工作100%的时间在本地,但未能约1开出3次对CircleCI与像ECONNREFUSED错误:CircleCI上的间歇硒ECONNREFUSED错误
Error: ECONNREFUSED connect ECONNREFUSED 10.0.4.1:59525
at ClientRequest.<anonymous> (node_modules/selenium-webdriver/http/index.js:238:15)
at Socket.socketErrorListener (_http_client.js:310:9)
at emitErrorNT (net.js:1278:8)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
From: Task: WebDriver.navigate().to(http://127.0.0.1:8080/src/public/login.php?t=ur&ign=1&ut=ad)
at thenableWebDriverProxy.schedule (node_modules/selenium-webdriver/lib/webdriver.js:816:17)
at Navigation.to (node_modules/selenium-webdriver/lib/webdriver.js:1140:25)
at thenableWebDriverProxy.get (node_modules/selenium-webdriver/lib/webdriver.js:997:28)
at User.logIn (testJs/ui/utils/user.js:9:16)
at Host.logInAsHost (testJs/ui/utils/host.js:13:14)
at Preferences.disableRevenueGeneration (testJs/ui/utils/preferences.js:57:14)
at Context.<anonymous> (testJs/ui/tests/preferences.js:13:22)
这些错误发生在整个测试中随机时间,他们没有被由我们测试中的任何特定地点触发。据我所知,这个问题发生在selenium/selenium-webdriver端,因为web服务器保持运行并且不会产生任何错误。
我已经尝试了所有的以下,其中没有一个已经工作:
- 升级到最新的硒的webdriver(3.4.0)
- 升级到较新版本的的NodeJS(6.9 0.2)
- 使用不同的Web服务器
- 升级到使用最新版本PhantomJS(1.9.7-15)
- 的尝试
export DBUS_SESSION_BUS_ADDRESS
按 https://github.com/SeleniumHQ/docker-selenium/issues/87 - 在node_modules/selenium-webdriver/http/index.js中,我修改了代码以重试ECONNREFUSED错误,方法是重新使用ECONNRESET中已有的重试,即
if (e.code === 'ECONNRESET') {
变为if (e.code === 'ECONNRESET' || e.code === 'ECONNREFUSED') {
。这不起作用,因为那时selenium-webdriver只是无限期地重试,并且从中我意识到问题似乎是一旦遇到ECONNREFUSED错误,硒/硒驱动程序是不可恢复的。
有没有人找到解决方案?