角度量角器错误 - 失败:ETIMEDOUT连接ETIMEDOUT 127.0.0.1:56018

时间:2017-10-04 20:25:32

标签: angular protractor angular-e2e angular-test

我正在使用我的某个页面的量角器进行e2e测试,有时我遇到Failed: ETIMEDOUT connect ETIMEDOUT 127.0.0.1:56018错误。

有一段时间它也没有任何错误。我不知道发生什么事了!

完整错误:

Failed: ETIMEDOUT connect ETIMEDOUT 127.0.0.1:56018
Error: ETIMEDOUT connect ETIMEDOUT 127.0.0.1:56018
at ClientRequest.<anonymous> (/Users/pro1/node_modules/selenium-webdriver/http/index.js:238:15)
at emitOne (events.js:115:13)
at ClientRequest.emit (events.js:210:7)
at Socket.socketErrorListener (_http_client.js:401:9)
at emitOne (events.js:115:13)
at Socket.emit (events.js:210:7)
at emitErrorNT (internal/streams/destroy.js:64:8)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)Error
at ElementArrayFinder.applyAction_ (/Users/pro1/node_modules/protractor/lib/element.ts:482:23)
at ElementArrayFinder.(anonymous function).args [as getText] (/Users/pro1/node_modules/protractor/lib/element.ts:96:21)
at ElementFinder.(anonymous function).args [as getText] (/Users/pro1/node_modules/protractor/lib/element.ts:873:14)
at /Users/pro1/e2e/app/data-entity/sme/sme.e2e-spec.ts:107:37
at step (/Users/pro1/e2e/app/data-entity/sme/sme.e2e-spec.ts:47:23)
at Object.next (/Users/pro1/e2e/app/data-entity/sme/sme.e2e-spec.ts:28:53)
at fulfilled (/Users/pro1/e2e/app/data-entity/sme/sme.e2e-spec.ts:19:58)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
From asynchronous test:
    Error
at Suite.<anonymous> (/Users/pro1/e2e/app/data-entity/sme/sme.e2e-spec.ts:62:3)
at addSpecsToSuite (/Users/pro1/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1107:25)
at Env.describe (/Users/pro1/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1074:7)
at describe (/Users/pro1/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4399:18)
at Object.<anonymous> (/Users/pro1/e2e/app/data-entity/sme/sme.e2e-spec.ts:30:1)
at Module._compile (module.js:624:30)
at Module.m._compile (/Users/pro1/node_modules/ts-node/src/index.ts:392:23)
at Module._extensions..js (module.js:635:10)
at Object.require.extensions.(anonymous function) [as .ts] (/Users/pro1/node_modules/ts-node/src/index.ts:395:12)

2 个答案:

答案 0 :(得分:0)

当Protractor无法连接到您的本地Selenium Server时,通常会发生此错误。如果您确定您的Selenium Server正在端口56018上运行,那么您可能遇到与Protractor无关的网络问题。在 spec.conf.js 文件中,我会更新为使用默认的 4444 端口,用于Selenium和Protractor进行测试。

// spec.conf.js file
exports.config = {
    seleniumAddress: "http://127.0.0.1:4444/wd/hub"
    ...
}

// Command-line: Selenium through Protractor's webdriver-manager
webdriver-manager update
webdriver-manager start

// Command-line: Selenium through standalone
java -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver -jar /usr/local/bin/selenium-server-standalone-3.4.0.jar -port 4444

答案 1 :(得分:0)

当selenium服务器无法启动或Protractor无法连接到您的本地Selenium Server时,会发生此错误。 好吧,如果您使用谷歌浏览器测试您的应用程序,您可以使用

// spec.conf.js file
exports.config = {
    directConnect:true
}
在你的conf.js文件中

。它将忽略所有selenium服务器设置。并将直接使用镀铬驱动程序开始测试。