我們的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錯誤,硒/硒驅動程序是不可恢復的。
有沒有人找到解決方案?