量角器:ENOTFOUND getaddrinfo ENOTFOUND localhost localhost:4444

时间:2017-07-03 04:11:46

标签: node.js selenium protractor webdriver-manager

量角器没有启动,它甚至没有打开镀铬。 即使我已启动ENOTFOUND localhost localhost:4444并且我可以在浏览器中访问webdriver-manager,它只会向我显示此错误localhost:4444。我不知道该如何处理,我尝试重新安装Chrome,更新量角器和放大器。 webdriver-manager,升级Node.js,刷新我的DNS,但我仍然有错误。

错误:

[11:11:21] I/launcher - Running 1 instances of WebDriver
[11:11:21] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[11:11:26] E/launcher - ENOTFOUND getaddrinfo ENOTFOUND localhost localhost:4444
[11:11:26] E/launcher - Error: ENOTFOUND getaddrinfo ENOTFOUND localhost localhost:4444
  at ClientRequest.<anonymous> (/usr/local/lib/node_modules/protractor/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:400:9)
  at emitOne (events.js:115:13)
  at Socket.emit (events.js:210:7)
  at emitErrorNT (internal/streams/destroy.js:62:8)
  at _combinedTickCallback (internal/process/next_tick.js:102:11)
  at process._tickCallback (internal/process/next_tick.js:161:9)
From: Task: WebDriver.createSession()
  at Function.createSession (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:777:24)
  at Function.createSession (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/chrome.js:709:29)
  at createDriver (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/index.js:167:33)
  at Builder.build (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/index.js:623:16)
  at Hosted.getNewDriver (/usr/local/lib/node_modules/protractor/built/driverProviders/driverProvider.js:53:33)
  at Runner.createBrowser (/usr/local/lib/node_modules/protractor/built/runner.js:195:43)
  at q.then.then (/usr/local/lib/node_modules/protractor/built/runner.js:339:29)
  at _fulfilled (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:834:54)
  at self.promiseDispatch.done (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:863:30)
  at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:796:13)
  at /usr/local/lib/node_modules/protractor/node_modules/q/q.js:556:49
  at runSingle (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:137:13)
  at flush (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:125:13)
  at _combinedTickCallback (internal/process/next_tick.js:95:7)
  at process._tickCallback (internal/process/next_tick.js:161:9)
  at Function.Module.runMain (module.js:607:11)
  at startup (bootstrap_node.js:158:16)
  at bootstrap_node.js:575:3

这是NPM提供的日志:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/8.1.3/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'run',
1 verbose cli   'tests' ]
2 info using npm@5.0.4
3 info using node@v8.1.3
4 verbose run-script [ 'pretests', 'tests', 'posttests' ]
5 info lifecycle angular-app@1.0.1~pretests: angular-app@1.0.1
6 silly lifecycle angular-app@1.0.1~pretests: no script for pretests, continuing
7 info lifecycle angular-app@1.0.1~tests: angular-app@1.0.1
8 verbose lifecycle angular-app@1.0.1~tests: unsafe-perm in lifecycle true
9 verbose lifecycle angular-app@1.0.1~tests: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/ChrisVillaran/Documents/Projects/angular-app/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/tools:/platform-tools:/Users/ChrisVillaran/.yarn/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/google_appengine/:/usr/local/bin/closure-compiler.jar
10 verbose lifecycle angular-app@1.0.1~tests: CWD: /Users/ChrisVillaran/Documents/Projects/angular-app
11 silly lifecycle angular-app@1.0.1~tests: Args: [ '-c', 'protractor tests/config.js' ]
12 silly lifecycle angular-app@1.0.1~tests: Returned: code: 199  signal: null
13 info lifecycle angular-app@1.0.1~tests: Failed to exec tests script
14 verbose stack Error: angular-app@1.0.1 tests: `protractor tests/config.js`
14 verbose stack Exit status 199
14 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:283:16)
14 verbose stack     at emitTwo (events.js:125:13)
14 verbose stack     at EventEmitter.emit (events.js:213:7)
14 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:125:13)
14 verbose stack     at ChildProcess.emit (events.js:213:7)
14 verbose stack     at maybeClose (internal/child_process.js:897:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:208:5)
15 verbose pkgid angular-app@1.0.1
16 verbose cwd /Users/ChrisVillaran/Documents/Projects/angular-app
17 verbose Darwin 14.5.0
18 verbose argv "/usr/local/Cellar/node/8.1.3/bin/node" "/usr/local/bin/npm" "run" "tests"
19 verbose node v8.1.3
20 verbose npm  v5.0.4
21 error code ELIFECYCLE
22 error errno 199
23 error angular-app@1.0.1 tests: `protractor tests/config.js`
23 error Exit status 199
24 error Failed at the angular-app@1.0.1 tests script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 199, true ]

硒原木:

[14:57:32] I/start - java -Dwebdriver.chrome.driver=/usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.30 -Dwebdriver.gecko.driver=/usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.17.0 -jar /usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.4.0.jar -port 4444
[14:57:32] I/start - seleniumProcess.pid: 10704
14:57:33.378 INFO - Selenium build info: version: '3.4.0', revision: 'unknown'
14:57:33.379 INFO - Launching a standalone Selenium Server
2017-07-03 14:57:33.443:INFO::main: Logging initialized @590ms to org.seleniumhq.jetty9.util.log.StdErrLog
14:57:34.065 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
  registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform MAC
14:57:34.065 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped:
  registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform MAC
14:57:34.065 INFO - Driver class not found: com.opera.core.systems.OperaDriver
14:57:34.065 INFO - Driver provider com.opera.core.systems.OperaDriver registration is skipped:
Unable to create new instances on this machine.
14:57:34.066 INFO - Driver class not found: com.opera.core.systems.OperaDriver
14:57:34.066 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
2017-07-03 14:57:34.188:INFO:osjs.Server:main: jetty-9.4.3.v20170317
2017-07-03 14:57:34.256:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@14acaea5{/,null,AVAILABLE}
2017-07-03 14:57:34.321:INFO:osjs.AbstractConnector:main: Started ServerConnector@3bb3f24f{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2017-07-03 14:57:34.322:INFO:osjs.Server:main: Started @1470ms
14:57:34.322 INFO - Selenium Server is up and running

其他信息:

Machine: OS X 10.10.5
Google Chrome: 59.0.3071.115
Node: 8.1.3
NPM: 5.0.4
Protractor: 5.1.2
Webdriver Manager: 12.0.6

我的配置:

let SpecReporter = require('jasmine-spec-reporter').SpecReporter;

exports.config = {
  allScriptsTimeout: 1000 * 2500,
  capabilities: {
    'browserName': 'chrome'
  },
  onPrepare: function () {
    jasmine.getEnv().addReporter(new SpecReporter({
      spec: {
        displayStacktrace: true
      }
    }));
  },
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: [
    'tests/specs/login-view/login.js'
  ],
  jasmineNodeOpts: {
    defaultTimeoutInterval: 1000 * 2500,
    print: function() {}
  }
};

3 个答案:

答案 0 :(得分:2)

鉴于您正在使用OSX,您可能会错过

127.0.0.1 localhost 
来自/ etc / hosts

答案 1 :(得分:0)

尝试评论硒地址,如下所示。它应该工作。

//seleniumAddress: 'http://localhost:4444/wd/hub',

答案 2 :(得分:0)

在下面的行中发表评论

exports.config = {
    // seleniumAddress: 'http://chrome:4444/wd/hub',

    // Capabilities to be passed to the webdriver instance.
    capabilities: {
        browserName: 'chrome'
    },

    specs: ['Protractor/todo-spec.js']
};