selenium-standalone icon indicating copy to clipboard operation
selenium-standalone copied to clipboard

Issue in check-started.js function as it does not wait for 1 minute to start the server

Open mighty98 opened this issue 3 years ago • 1 comments
trafficstars

Expected Behavior

As per the comments in check-started.js function (Line 37) server should be allowed 1 minute to start but as per the logic it wait for just 15 seconds

let attempts = 29; const startTime = Date.now(); while (attempts > 0 && Date.now() - startTime < 30000) { await sleep(500); attempts--; if (cpState.exited) { throw new Error( Selenium exited before it could start with code ${cpState.code}\nStdout: ${cpState.stdout}\nStderr: ${cpState.stderr} ); } try { // server has one minute to start await got(seleniumStatusUrl, options); selenium.removeListener('exit', errorIfNeverStarted); return null; } catch (err) { // suppress some messages if (attempts % 5 === 0) { console.error('Failed to connect to selenium.', 'Attempts left:', attempts, '\n', err.message); } } }

Current Behavior

As per above logic we wait actually just 15 seconds for the server to start Instead shouldn't the code be as below (wait max 60 seconds and check every 2 seconds) let attempts = 29; const startTime = Date.now(); while (attempts > 0 && Date.now() - startTime < 60000) { await sleep(2000); attempts--;

Your Environment

  • Version of selenium-standalone that you are using: 8.0.9
  • Is there another tool calling selenium-standalone on your behalf: @wdio/selenium-standalone-server
  • System/platform:Windows/Ubuntu
  • Other details that might be important:

mighty98 avatar Feb 02 '22 05:02 mighty98

Thanks for reporting!

Any contributions that resolves the bug are highly appreciated. Please take a look into our contribution guidelines and let us know if you have any questions. Cheers!

christian-bromann avatar Mar 08 '22 07:03 christian-bromann

It has been resolved in https://github.com/webdriverio/selenium-standalone/pull/668

udarrr avatar Oct 04 '23 10:10 udarrr