1

我正在使用我的一个页面的量角器进行 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)
4

2 回答 2

0

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

// spec.conf.js file
exports.config = {
    directConnect:true
}

在您的 conf.js 文件中。它将忽略所有 selenium 服务器设置。并将直接使用 chrome 驱动程序开始您的测试。

于 2017-10-05T06:42:55.147 回答
0

当 Protractor 无法连接到本地 Selenium 服务器时,通常会发生此错误。如果您确定您的 Selenium 服务器在端口 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
于 2017-10-04T20:42:38.997 回答