Can I set a longer timeout for the protractor to connect to the selenium driver?

Running my trial protranslators remotely (jenkins) sometimes results in a timeout error. It is not deterministic.

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

/opt/jenkins.dir/workspace/my-jenkins-job/integration-test/ui/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1761
      throw error;
            ^
Error: Timed out waiting for the WebDriver server at http://10.97.193.53:4455/wd/hub
    at Error (<anonymous>)
    at onResponse (/opt/jenkins.dir/workspace/my-jenkins-job/integration-test/ui/node_modules/protractor/node_modules/selenium-webdriver/http/util.js:87:11)
    at /opt/jenkins.dir/workspace/my-jenkins-job/integration-test/ui/node_modules/protractor/node_modules/selenium-webdriver/http/util.js:42:21
    at /opt/jenkins.dir/workspace/my-jenkins-job/integration-test/ui/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/http/http.js:96:5
    at ClientRequest.<anonymous> (/opt/jenkins.dir/workspace/my-jenkins-job/integration-test/ui/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:145:7)
    at ClientRequest.emit (events.js:95:17)
    at Socket.socketErrorListener (http.js:1548:9)
    at Socket.emit (events.js:95:17)
    at net.js:441:14
    at process._tickCallback (node.js:448:13)

      

However, when I run the tests locally on my mac, there is no problem and the tests run fine.

I tried to start selenium servers manually on remote computers and I realized that sometimes it works immediately and sometimes I have to wait up to one minute.

My question is: Is there a way to tell the protractor to wait longer for the web server to connect?

About environments

  • Machine: Red Hat 4.4.7-11
  • Pusher version: 1.8.0
  • Selenium standalone server: 2.45.0
+3


source to share


2 answers


You can specify it using the driver.wait function.

var webdriver = require('selenium-webdriver');
var protractor = require('protractor');

var driver = new webdriver.Builder().usingServer("seleniumAddress").build();
var browser = protractor.wrapDriver(driver);

browser.driver.wait(driver.getWindowHandle(), 5000, 'Server should start within 5 seconds');

      



Links:

0


source


Yes, and it should solve your problem. Use the seleniumServerStartTimeout parameter in your protractor.conf.js file to increase the timeout from the default 30 seconds to about 90 seconds:

exports.config = { 
  seleniumServerStartTimeout: 90000
};

      



I ran into the same issue on a CentOS 7 VM. For some reason, the selenium server seems to take completely different amounts of time to start each time and can sometimes exceed the default timeout.

0


source







All Articles