Difference between timeout and browserTimeout
Asked Answered
A

1

8

I just started using Selenium Grid.

The current problem I'm facing is when a test crashes. The browser stays open forever until I arrive and close it myself so the next set of tests can start.

I noticed that the NODE configuration has two timeout configurations, one for -timeout and another for -browserTimeout

For the -timeout, it says the browser will be "released" for another test. For -browserTimeout, it simply doesn't say anything.

I don't understand what it meant by "released".

What I need is the browser to be closed when the timeout happens.

What option will close the browser?

Armendariz answered 16/9, 2016 at 18:45 Comment(1)
NOTE1 : Already googled and couldn't find anything that would suggest what one or the other configuration does. NOTE2: I'm asking here without testing by myself because it's a 19 hours set of tests that can't be stopped when started and is not trivial for me to ask the sys-admin to try with config A and then try again with config B.Armendariz
G
22

This documentation should help you out

Quoting the documentation

  • timeout 30 (300 is default) The timeout in seconds before the hub automatically releases a node that hasn't received any requests for more than the specified number of seconds. After this time, the node will be released for another test in the queue. This helps to clear client crashes without manual intervention. To remove the timeout completely, specify -timeout 0 and the hub will never release the node.
  • browserTimeout On the hub you can also set -browserTimeout 60 to make the maximum time a node is willing to hang inside the browser 60 seconds.

Here's my limited understanding

  • timeout - This value represents how long should the Grid wait before it treats a particular test session (a particular running test case) as stale, so that that particular test session can be cleaned up and the slot released so that some other test case can basically execute on the node. This parameter is relevant when lets say you are running a test case from within eclipse and you click on the RED button and end your test case abruptly. At that time the client (your test case) hasn't sent a "end-session" signal to the remote. So this session is stale and the grid has to clean up this orphan session.
  • browserTimeout - This value represents how long should the Grid wait before it treats a particular test session (a particular running test case) as stale, due to the browser getting hung (maybe due to a browser crash or due to a rogue javascript on the web application which has frozen the browser). Here the important thing to note is that the client (the test case running from within your IDE or a Continuous Integration tool such as Jenkins for e.g.,) is still active but its the browser that has got un-responsive.

So to safe guard your executions from orphaned test sessions due to client crashes use timeout and use browserTimeout to safe guard your grid from frozen browsers which refuses to return back and causes stalled test executions.

Godhead answered 17/9, 2016 at 17:15 Comment(4)
To make it clear, browserTimeout should be smaller than timeout, right?Armendariz
Yes that is correct. You can get more information from the official documentation here github.com/SeleniumHQ/selenium/wiki/…Godhead
It didn't work. At some point, the application session expired and the browser was just there, hanging up and no one (hub or node) closed anything so the tests could move on.Armendariz
Adding valid links for 2022 to Selenium 2 Grid and Selenium 3 Grid: selenium.dev/documentation/legacy/selenium_2/grid_2 selenium.dev/documentation/legacy/selenium_3/grid_setupBrigitte

© 2022 - 2024 — McMap. All rights reserved.