Difference between timeout and browserTimeout

2020-07-14 10:08发布

问题:

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?

回答1:

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.