AngularJS Book, error on sh scripts/e2e-test.sh

I’m trying to execute the sh scripts/e2e-test.sh on a Mac, then I get a message: “To view this web content, you need to install the java runtine enviroment”. I clicked more info and install java, then a try to execute sh scripts/e2e-test.sh again, but still getting the same message, also on my console I get the following timeout message:

sh scripts/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:57603/wd/hub
at Error ()
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. (/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)

How can I solve this issues.

Thanks in advance

Which version of the selenium-webdriver package are you using?
It could be a bug: http://stackoverflow.com/questions/23546919/node-selenium-webdriver-error-timed-out-waiting-for-the-webdriver-server-at

I really don’t know. How to know the version???

How did you install it?
Which OS?

I’m on Mac OS X Yosemite 10.10.2. This is how I installed the package:

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

then I tried to run:

sh scripts/e2e-test.sh

and get the error.

You should be able to see the version in:

/Users/Jean/repos/angularjsbook/chapter1/node_modules/protractor/package.json

Look for:

"dependencies": {
  ...
  "selenium-webdriver": "xxx",
  ...
},

What does that say?

It say:

“selenium-webdriver”: “2.44.0”

according to the stackoverflow the error is with the 2.41.0 version, but they suggest to downgrading to 2.9.248307 but I don’t know to make a downgrade.

:sweat:

What is the title of the book you are reading?
I will see if I can get a copy of it and if I can reproduce your issue.

This one:

Ok, leave it with me. I’ll see what I can do and post back here in a couple of days.

So, I got a copy of the book. Which page are you on?
How can I reproduce your problem?

I have the kindle version and it says 11% Loc 445 of 4302 in the Title:

Figure 1.3 Updated results

For End-to-End Test

If you are on Mac, use the command: sh scripts/e2e-test.sh. On Windows…

Hi,

So, I’m on Linux and I’m afraid it worked fine for me.
I’ll list the steps I took in case you spot something you missed:

angular-seed/app/test.html:

<!doctype html>
<html lang="en" ng-app>
  <head>
    <title>My First AngularJS App</title>
  </head>
  <body ng-init="salary=0;percentage=0">
    Your Salary?
    <input type="text" ng-model="salary"><br/>
    How much should you invest in gadgets?
    <input type="text" ng-model="percentage">%<br/>
    The amount to be spent in shopping will be:
    <span>{{salary*percentage*0.01}}</span>
    <script src="lib/angular/angular.js"></script>
  </body>
</html>

Then (I already had node and npm installed), I ran node scripts/web-server.js and navigated to http://localhost:8000/app/test.html. It worked.

After that I ran the following commands from the angular-seed directory.

  • npm install karma
  • npm install jasmine
  • npm install karma-chrome-launcher
  • npm install protractor

I then made sure that the test server was still running on port 8000 (as described above) and ran:

sh scripts/e2e-test.sh

This was the output:

Updating WebDriver
scripts
-------------------------------------------------------------------
Updating selenium standalone
downloading https://selenium-release.storage.googleapis.com/2.44/selenium-server-standalone-2.44.0.jar...
Updating chromedriver
downloading https://chromedriver.storage.googleapis.com/2.14/chromedriver_linux64.zip...
chromedriver_2.14.zip downloaded to /home/jim/Desktop/angular-seed/node_modules/protractor/selenium/chromedriver_2.14.zip
selenium-server-standalone-2.44.0.jar downloaded to /home/jim/Desktop/angular-seed/node_modules/protractor/selenium/selenium-server-standalone-2.44.0.jar

Starting Protractor tests
scripts
-------------------------------------------------------------------
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://192.168.178.35:51111/wd/hub
FFF

Failures:

  1) my app should automatically redirect to /view1 when location hash/fragment is empty
   Message:
     Expected 'http://localhost:8000/app/index.html' to match '/view1'.
   Stacktrace:
     Error: Failed expectation
    at [object Object].<anonymous> (/home/jim/Desktop/angular-seed/test/e2e/scenarios.js:10:41)

  2) my app view1 should render view1 when user navigates to /view1
   Message:
     Error: Index out of bound. Trying to access element at index: 0, but there are only 0 elements that match locator By.cssSelector("[ng-view] p")
   Stacktrace:
     Error: Index out of bound. Trying to access element at index: 0, but there are only 0 elements that match locator By.cssSelector("[ng-view] p")
==== async task ====
Asynchronous test function: it()
Error
    at [object Object].<anonymous> (/home/jim/Desktop/angular-seed/test/e2e/scenarios.js:22:57)
Error
    at [object Object].<anonymous> (/home/jim/Desktop/angular-seed/test/e2e/scenarios.js:21:5)
    at [object Object].<anonymous> (/home/jim/Desktop/angular-seed/test/e2e/scenarios.js:14:3)
    at Object.<anonymous> (/home/jim/Desktop/angular-seed/test/e2e/scenarios.js:5:1)

  3) my app view2 should render view2 when user navigates to /view2
   Message:
     Error: Index out of bound. Trying to access element at index: 0, but there are only 0 elements that match locator By.cssSelector("[ng-view] p")
   Stacktrace:
     Error: Index out of bound. Trying to access element at index: 0, but there are only 0 elements that match locator By.cssSelector("[ng-view] p")
==== async task ====
Asynchronous test function: it()
Error
    at [object Object].<anonymous> (/home/jim/Desktop/angular-seed/test/e2e/scenarios.js:37:57)
Error
    at [object Object].<anonymous> (/home/jim/Desktop/angular-seed/test/e2e/scenarios.js:36:5)
    at [object Object].<anonymous> (/home/jim/Desktop/angular-seed/test/e2e/scenarios.js:29:3)
    at Object.<anonymous> (/home/jim/Desktop/angular-seed/test/e2e/scenarios.js:5:1)

Finished in 1.622 seconds
3 tests, 3 assertions, 3 failures

Shutting down selenium standalone server.
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 failed 3 test(s)
[launcher] overall: 3 failed spec(s)
[launcher] Process exited with error code 1

As you can see, the test failed, but were at least executed.

So, back to your problem, the main points to check are:

  • is the node server running
  • did you install all of the dependencies
  • are you running the commands from within the correct directory

If this doesn’t help, then I would suggest heading over to the learnable site and asking for help there:
https://learnable.com/books/angularjs-novice-to-ninja/online/ch01s06.html

The author seems to be responding to people and maybe someone on a Mac will be able to help you further.

Good luck!

1 Like

Thanks you. I would try with the learnable link

Ready Pullo, I did not have java install on my os x (I was trying to install java from the java.com page), I have to installed from the apple java version from this link: http://support.apple.com/kb/DL1572. Once again, thanks for your help.

Glad you got things sorted : )

Just by way of info - you can like any posts you have found helpful or that you think make a good point (by hitting the heart next to the respective posts).

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.