Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

protractor stand alone selenium fails: Error: Timed out waiting for the WebDriver server at

I have installed protractor with the stand alone selenium server:

webdriver-manager update

If I run protractor with the stand alone server already running and the config pointed at that selenium instance it works fine.

I want to have protractor start the server and then run the tests. By default protractor finds chrome driver and the selenium server jar so I am using a minimal config:

exports.config = {
    capabilities: {
        'browserName': 'chrome'
    },
    specs: ['test/e2e/*.js']
};

But when it launches it can't connect to the server.

Error: Timed out waiting for the WebDriver server at http://192.168.1.146:56159/
wd/hub

I have noticed that when starting seleniumn with webdriver-manager start that the server starts up on localhost. I can't seem to get protractor to do the same.

My guess is that the firewall is preventing the connection.

Environment Version info: - grunt v0.4.1
- node 0.10.18 - selenium-server-standalone-2.37.0.jar - selenium-server-standalone-2.38.0.jar - protractor 0.14.0 - windows 7 Pro

like image 440
Joe Avatar asked Dec 12 '13 22:12

Joe


2 Answers

Add the server to your config:

exports.config = {
  // The address of a running selenium server.
  seleniumAddress: 'http://localhost:4444/wd/hub',

  capabilities ...
}
like image 181
Andres D Avatar answered Oct 20 '22 20:10

Andres D


If you need a stand alone server for Chrome only, you may use the Selenium ChromeDriver executable. webdriver-manager update --chrome should do that for you, or if you're behind the company VPN or proxy, you may download it manually from http://chromedriver.storage.googleapis.com/2.9/chromedriver_win32.zip to C:\Users\*your-user-name*\AppData\Roaming\npm\node_modules\protractor\selenium (protractor 0.22.0 matches chromedriver 2.9). Incorrect version of ChromeDriver, e.g. 2.10, can indeed cause the Error: Timed out waiting for the WebDriver server at ....

Your configuration file should look like the following:

exports.config = {
  chromeOnly: true,
  chromeDriver: '../selenium/chromedriver',
  capabilities: {
    'browserName': 'chrome'
  },
  specs: ['test/e2e/*.js'],
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 30000
  }
};
like image 30
Ilia Barahovsky Avatar answered Oct 20 '22 20:10

Ilia Barahovsky