BROWSERSTACK_IDLE_TIMEOUT

This document guides you with the steps to resolve the BROWSERSTACK_IDLE_TIMEOUT error.

This error occurs when a session is idle for more than the set timeout, which is generally 90 seconds. This happens as BrowserStack by default waits for the timeout duration for additional steps or commands to run, if BrowserStack does not receive any command during that time, the session is stopped, changing the session status to TIMEOUT on the Automate dashboard.

Following are some mechanisms to avoid this error:

Inform BrowserStack that a test is completed

BrowserStack does not know when you are done with all the steps in your Selenium test. The driver.quit Selenium command, helps us identify that all the steps of the Automate test are finished and the test is completed. You should call the driver.quit command after all the steps in your test script.

Refer to the below code snippets on how to call the driver.quit command in your test script:

driver.quit();
driver.quit();
driver.Quit();
$driver->quit();
driver.quit()
driver.quit
$driver->quit();

Increase timeout duration

BrowserStack triggers the BROWSERSTACK_IDLE_TIMEOUT error when a session is left idle for more than 90 seconds. The browserstack.idleTimeout capability helps us increase the timeout value in case the web page takes longer than 90 seconds to open. You can set a timeout value from 0 to 300 seconds. The default value is 90 seconds.

Example: "browserstack.idleTimeout": 120

Handle exceptions

Your test script can run into exceptions, resulting in the driver.quit command not getting fired. To handle such exceptions, you should use a try…catch block. A general approach to use try…catch in your test script:

  • Use a try…catch block.
  • Log the exception.
  • Handle the exception. If you are trying to find an element on a webpage, you can use a different XPath.
  • Continue running the remaining steps in your test script.
  • Trigger the driver.quit command at end of your test script.

Specify a longer wait duration in the test script

Configure timeout in your test frameworks.

For example, you may have configured a timeout of 30 seconds in your test framework. A request to open a web page may take longer than 30 seconds, in such a case the test would get timed out.

You can refer to the below links for configuring timeout in your framework:

The above steps should help you resolve the BROWSERSTACK_IDLE_TIMEOUT error. If you need additional help, please contact our Support team.

We're sorry to hear that. Please share your feedback so we can do better






Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback