How can i increase session timeout (which is 30 minutes by default)

3.8k views Asked by At

I want to handle server timeout in programmatically.

My codes goes like this.

SelendroidConfiguration config = new SelendroidConfiguration();
config.addSupportedApp("apk/test.apk");
selendroidServer = new SelendroidLauncher(config);

    URL url = new URL("http://localhost:4444/wd/hub");
    // -------------------------------------------------------
    SelendroidCapabilities test= SelendroidCapabilities
            .device("com.test.android:1.0");
    driver = new SelendroidDriver(url, test);
4

There are 4 answers

0
Madis Kangro On BEST ANSWER

I had the same problem when tests started failing. You have set up the config already. Just add this line.

  config.setSessionTimeoutSeconds(60000);
0
Chandan Nayak On

you can use this to increase it to 50 seconds

java -jar selendroid-standalone-0.11.0-with-dependencies.jar -timeoutEmulator 50000

source

0
Aleksandras On

The most optional way to solve this is to add the following attribute to the cmd line: "-timeout". Keep in mind that its value should be included in seconds (it's 1800=30 min by default).

So it looks like this:

java -jar  -htmlSuite "various suite parameters" -timeout 3600

So, server shall remain active for an hour instead of 30 min. Interestingly enough, this is not well-documented and it's really hard to find a proper solution to alter this setting.

You can read more about it here: https://wiki.mozilla.org/Running_IDE_scripts_with_Selenium_RC

0
Kira On

Though not applicable to SelendroidConfiguration, when launching selenium standalone using docker, --session-timeout flag inside SE_OPTS works:

docker run -d -p 4445:4444 -p 5901:5900 -p 7901:7900 -e SE_OPTS="--session-timeout 1000" --shm-size=2g selenium/standalone-chrome:105.0

It doesn't work with standalone-chrome-debug though:

docker run -d -p 4445:4444 -p 5901:5900 -p 7901:7900 -e SE_OPTS="--session-timeout 100" --shm-size=2g selenium/standalone-chrome-debug:3.141.59-20210607