I am using selenium for automating some interactions with websites. This process involves opening several browsers and having them perform actions intermittently. However, occasionally there are long (> 1 hour) periods of inaction, and selenium seems to automatically kill browser sessions after ~30 minutes of not being called.
I would like to set this timeout to 7 hours or so, but I cannot find any way of doing this.
This is the message selenium sends as it helpfully closes an idle browser.
13:06:35.277 INFO [ActiveSessions$1.onStop] - Removing session 70a1b8cbae6876cde7e66df13b3942d1 (org.openqa.selenium.chrome.ChromeDriverService)
If Anyone has any leads I would be super grateful. At the moment I'm just auto-refreshing browsers every 15 minutes to prevent timeouts but it feels gross.
If Current time - Test start time >= 30 minute s then check if system logout and if yes then login again. but for this question is same like I have to call it in either every method or in some specific methods to check every time if logout or not.
-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.
To start the selenium test on the existing or already opened window we need to use Chrome DevTools Protocol.
This error message...
INFO [ActiveSessions$1.onStop] - Removing session 70a1b8cbae6876cde7e66df13b3942d1 (org.openqa.selenium.chrome.ChromeDriverService)
...implies that the already initiated/spawned a new Chrome Browser Session was terminated.
This issue is observed with Selenium Grid Hub/Node configuration and/or RemoteWebdriver implementation.
If you observe the -help
of selenium-server-standalone-x.y.z.jar
the default -timeout
/ -sessionTimeout
is set to 1800 seconds.
CLI Command:
$>java -jar selenium-server-standalone-3.14.0.jar -help
Output:
-timeout
,-sessionTimeout
:<Integer>
in seconds : Specifies the timeout before the server automatically kills a session that hasn't had any activity in the last X seconds. The test slot will then be released for another test to use. This is typically used to take care of client crashes. For grid hub/node roles, cleanUpCycle must also be set.
Default value: 1800
Snapshot:
Hence, you see the time out and it appears selenium automatically kills the browser session after ~30 minutes of not being called.
You can increase the -timeout
/ -sessionTimeout
as follows:
$>java -jar /path/to/selenium-server-standalone-3.14.0.jar -sessionTimeout 57868143
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With