Selenium在http://192.168.1.34:62334/wd/hub等待WebDriver服务器超时

时间:2015-02-21 13:51:45

标签: angularjs selenium npm

我正在读一本书(angularjs:novice to ninja),并在执行以下命令和安装后:

npm install karma
npm install jasmine
npm install karma-chome-launcher
npm install protractor

然后我尝试运行以下测试:

sh scripts/test.sh 
sh scripts/e2e-test.sh

但sh脚本/ e2e-test.sh给了我以下错误:

Updating WebDriver
scripts
-------------------------------------------------------------------
selenium standalone is up to date.
chromedriver is up to date.

Starting Protractor tests
scripts
-------------------------------------------------------------------
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
[launcher] Process exited with error code 1

/Users/Jean/repos/angularjsbook/chapter1/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1761
      throw error;
            ^
Error: Timed out waiting for the WebDriver server at http://192.168.1.34:62334/wd/hub
    at Error (<anonymous>)
    at onResponse (/Users/Jean/repos/angularjsbook/chapter1/node_modules/protractor/node_modules/selenium-webdriver/http/util.js:87:11)
    at /Users/Jean/repos/angularjsbook/chapter1/node_modules/protractor/node_modules/selenium-webdriver/http/util.js:42:21
    at /Users/Jean/repos/angularjsbook/chapter1/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/http/http.js:96:5
    at ClientRequest.<anonymous> (/Users/Jean/repos/angularjsbook/chapter1/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:145:7)
    at ClientRequest.emit (events.js:95:17)
    at Socket.socketErrorListener (http.js:1552:9)
    at Socket.emit (events.js:95:17)
    at net.js:441:14
    at process._tickCallback (node.js:442:13)

我在论坛的论坛上找不到任何东西。请帮忙

2 个答案:

答案 0 :(得分:1)

我必须从这个链接安装java:https://support.apple.com/kb/DL1572?locale=en_US因为,Apple不允许从www.java.com安装java

答案 1 :(得分:0)

也许,当'npm run update-webdriver'上下载chrome web驱动程序并且光标只是闪烁几秒延长时,你可能已经终止了批处理作业,认为它已经结束,此后运行量角器开始出现这个问题。

一种简单的方法是从头开始重新创建所有内容,因为我不确定卸载webdriver是否会在安装的Chrome浏览器中出现其他问题。