Normaly you are using selenium to automate testcases and after the testcase finished running, the browser closes.
However I try to use selenium webdriver to script specific tasks, e.g. login to a specific page but the browser should stay open after it.
I need the browser to stay open, because I developed a CMS where you can define selenium tasks and execute them. One of the tasks is to login to a backend, but I need to keep the website open forever, so that I can work in the backend. Problem: after about 20 minutes or so the browser which opened by starting the testcase, closes again.
I developed the portal so that I don't have to login to all my backends if I start working at the morning, I only have to login once into my portal and from there I can trigger everything I need.
I do it like this to login to typo3 backend (snippet):
$username_field = $SeleniumObj->byId('t3-username', true);
$pw_field = $SeleniumObj->byId('t3-password', true);
$submitButton = $SeleniumObj->byId('t3-login-submit', true);
$username_field->sendKeys("myusername");
$pw_field->sendKeys("mypasswd");
$submitButton->click();
exit;
You can see that I call exit
at the end so that the "testcase" ends and the page stays open.
How to set the browser lifetime to infinite?
NOTES: I am using the latest selenium and facebook php-webdriver with custom code wrappers.