How to disable selenium chrome driver's auto closed action after some time without activity?

被刻印的时光 ゝ 提交于 2019-12-08 15:22:36

I have found the clue from code here

-sessionTimeout

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. If a node does not specify it, the hub value will be used.

The timeout is indeed 1800s, it is the same the log expected.

And then I found another question about this.

java -jar /opt/selenium/selenium-server-standalone.jar -sessionTimeout 31536000

I am not familiar with java. I used selenium/standalone-chrome-debug:3.141.59-mercury docker image to run the chromdriver. So if you also use docker, you can set env when running docker.

This is my docker-compose file:

chrome:
  image: selenium/standalone-chrome-debug:3.141.59-mercury
  volumes:
    - /dev/shm:/dev/shm
  ports:
    - 127.0.0.1:4444:4444
    - 127.0.0.1:5900:5900
  environment:
     - SE_OPTS=-sessionTimeout 31536000

It is about one year timeout.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!