aerokube / selenoid

Selenium Hub successor running browsers within containers. Scalable, immutable, self hosted Selenium-Grid on any platform with single binary.
https://aerokube.com/selenoid/latest/
Apache License 2.0
2.6k stars 324 forks source link

Ability to set timeout for a session #262

Closed sherlock1982 closed 6 years ago

sherlock1982 commented 7 years ago

It would be nice to have a timeout as a capability per session. Maybe there should be a system parameter for a maxTimeout. Currently I can't debug with Selenoid. Default timeout 1 min is ok but not for debugging.

Unfortunately I can't use geckodriver standalone with WebdriverIO for now.

vania-pooh commented 7 years ago

@sherlock1982 timeout parameter is set via -timeout Selenoid flag. Default value is 1 min but you can set any timeout you wish. Btw, we have Telegram support channel here: https://t.me/aerokube @aandryashin any thoughts against this feature?

sherlock1982 commented 7 years ago

There's one more motivation: unit tests. Sometimes it's convenient for me to run karma unit tests inside selenoid. But than during timeout tests should be finished.

So I want to set a timeout for unit tests more than for ui.

Alek5andr commented 6 years ago

@vania-pooh , could please show a good example of setting up Selenoid's flag using Docker? Documentation does not help.

My command is: docker run -d --name selenoid -p 4444:4444 -v /var/run/docker.sock:/var/run/docker.sock -vpwd/config/:/etc/selenoid/:ro aerokube/selenoid:latest-release -timeout 3m0s The container starts, but immediately exits with code 1.

"Binds" section of docker inspect selenoid contains the following: "Binds": [ "/home/localadmin/.aerokube/selenoid/:/etc/selenoid/:ro", "/var/run/docker.sock:/var/run/docker.sock" ] If I start the container without Selenoid's flags, then it's up and running.

Advise please, how to set Selenoid's flags correctly.

aandryashin commented 6 years ago

There should be $(pwd) instead of pwd, could you please chech it?

19 дек. 2017 г. 6:39 ПП пользователь "Alek5andr" notifications@github.com написал:

Vania, could please show a good example of setting up Selenoid's flag using Docker? Documentation http://aerokube.com/selenoid/latest/#_selenoid_cli_flags does not help.

My command is: docker run -d --name selenoid -p 4444:4444 -v /var/run/docker.sock:/var/run/docker.sock -vpwd/config/:/etc/selenoid/:ro aerokube/selenoid:latest-release -timeout 3m0s The container starts, but immediately exits with code 1.

"Bind" section of docker inspect selenoid contains teh following: "Binds": [ "/home/localadmin/.aerokube/selenoid/:/etc/selenoid/:ro", "/var/run/docker.sock:/var/run/docker.sock" ] If I start the container without Selenoid's flags, then it's up and running.

Advise please, how to set Selenoid's flasg correctly.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aerokube/selenoid/issues/262#issuecomment-352795608, or mute the thread https://github.com/notifications/unsubscribe-auth/ABWNbWubPRXLb5zypokKZRf6ul1q4B0Jks5tB9jJgaJpZM4QQUO1 .

vania-pooh commented 6 years ago

@Alek5andr you are passing arguments correctly. However take a look at the Dockerfile. It contains the following lines:

ENTRYPOINT ["/usr/bin/selenoid"]

CMD ["-listen", ":4444", "-conf", "/etc/selenoid/browsers.json", "-video-output-dir", "/opt/selenoid/video/"]

That is to say - when you specify your own args, you have to specify required ones too. The only required arg is -conf. So to solve your issue just type the following:

docker run -d --name selenoid -p 4444:4444 -v /var/run/docker.sock:/var/run/docker.sock -v $(pwd)/config/:/etc/selenoid/:ro aerokube/selenoid:latest-release -timeout 3m0s -conf /etc/selenoid/browsers.json

If you wish to use video feature you have to also add an environment variable, one more volume and -video-output-dir flag.

Alek5andr commented 6 years ago

@aandryashin , Github didn't escape `-sign. Thanks for $(pwd) reference.

@vania-pooh , I have started to use Docker with Selenoid recently. So I'm new to it, and I didn't pay attention to directory with config file for "-conf" flag. Now I see that this directory should be within a container - -conf /etc/selenoid/browsers.json, not a host's one. Thank you for the thorough explanation and the example.

By the way, I have been working with Selenium Grid most of the time. Could you please specify, what are equivalent Selenoid flags from the documentation:

-service-startup-timeout -session-attempt-timeout -session-delete-timeout -timeout

to Selenium Grid ones:

-browserTimeout -timeout -newSessionWaitTimeout

?

vania-pooh commented 6 years ago

@Alek5andr 1) -timeout is the same thing for both related to idle time between requests. 2) -browserTimeout does not exist in Selenoid. 3) -session-attempt-timeout is the same as -newSessionWaitTimeout.

vania-pooh commented 6 years ago

Related to https://github.com/aerokube/ggr/issues/195.

ghost commented 6 years ago

@sherlock1982 hello could you please share you contacts I want to ask you some questions about karma + selenoid setup