有时,Protractor无法使用EADDRINUSE 127.0.0.1:4444错误执行测试

时间:2016-07-04 07:28:18

标签: node.js webdriver protractor

我使用的是带有多个功能的protactor 1.8,其中7个浏览器实例并行运行。我总能成功地运行我的测试服。我最近将我的量角器更新到版本3.2.2。我的测试套装开始间歇性地返回以下错误消息。

    Error: EADDRINUSE connect EADDRINUSE 127.0.0.1:4444
    [chrome #31]     at ClientRequest.<anonymous> (C:\myAppe2e\node_modules\protractor\node_modules\selenium-webdriver\http\index.js:365:15)
    [chrome #31]     at emitOne (events.js:77:13)
    [chrome #31]     at ClientRequest.emit (events.js:169:7)
    [chrome #31]     at Socket.socketErrorListener (_http_client.js:267:9)
    [chrome #31]     at emitOne (events.js:77:13)
    [chrome #31]     at Socket.emit (events.js:169:7)
    [chrome #31]     at emitErrorNT (net.js:1253:8)
    [chrome #31]     at nextTickCallbackWith2Args (node.js:442:9)
    [chrome #31]     at process._tickCallback (node.js:356:17)
    [chrome #31] From: Task: WebElement.isSelected()
    [chrome #31]     at WebDriver.schedule (C:\myAppe2e\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:344:17)
    [chrome #31]     at WebElement.schedule_ (C:\myAppe2e\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:1712:25)
    [chrome #31]     at WebElement.isSelected (C:\myAppe2e\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:2023:17)
    [chrome #31]     at actionFn (C:\myAppe2e\node_modules\protractor\built\element.js:82:76)
    [chrome #31]     at Array.map (native)
    [chrome #31]     at C:\myAppe2e\node_modules\protractor\built\element.js:374:46
    [chrome #31]     at Promise.invokeCallback_ (C:\myAppe2e\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:1329:14)
    [chrome #31]     at TaskQueue.execute_ (C:\myAppe2e\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2790:14)
    [chrome #31]     at TaskQueue.executeNext_ (C:\myAppe2e\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2773:21)
    [chrome #31]     at C:\myAppe2e\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2652:27
    [chrome #31]     at C:\myAppe2e\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:639:7
    [chrome #31]     at process._tickCallback (node.js:369:9)
    [chrome #31] Error
    [chrome #31]     at ElementArrayFinder.applyAction_ (C:\myAppe2e\node_modules\protractor\built\element.js:371:27)
    [chrome #31]     at ElementArrayFinder._this.(anonymous function) [as isSelected] (C:\myAppe2e\node_modules\protractor\built\element.js:83:30)
    [chrome #31]     at ElementFinder._this.(anonymous function) [as isSelected] (C:\myAppe2e\node_modules\protractor\built\element.js:685:22)

1 个答案:

答案 0 :(得分:1)

最有可能的不是webdriver配置问题。更改端口最初可能会有所帮助,但如果程序正在消耗VM /机器上的可用端口,则此修复程序将无助于太长时间。这是我面临的同样问题;所以我创建了一个批处理脚本(运行我的自动化之前):

net session /delete

关闭所有打开的,TIME_WAIT和CLOSE_WAIT连接。之后立即重新进行测试,他们在没有EADDRINUSE错误的情况下运行。希望这有助于至少解决方法。祝你好运!