3

My script searches for different strings in different tabs of a browser. Is there a way to keep the browser open after test execution is over so that results can be checked at a later time? Currently the browser closes automatically after 5 mins even though i am not using driver.quit().

Selenium: 2.33, Win 7, FF and Chrome

vaibhav misra
  • 135
  • 6
  • 19

3 Answers3

0

I don't know if you can let the browser open. But may I suggest you to use the TakeScreenshot functionality of Selenium in order to save the state of the browser when you want. That could help you to debug or to check that the page is as expected.

If this solution doesn't help you, could you please explain us exactly why you want to keep the browser open?

Community
  • 1
  • 1
LaurentG
  • 11,128
  • 9
  • 51
  • 66
  • As mentioned I am performing a search with diff strings in diff tabs. Some of the results returned run into several pages therefore taking screenshot is not a viable option. I need to keep the browser open so that someone at a later time and come and check the results. The browser window closes after 5 mins and its possible that person who ran the test was busy during this time. – vaibhav misra Jun 22 '13 at 17:48
  • Is there no solution to my problem??? i tried using thread.sleep to pause the execution flow but still FF browser closes after 5 mins....is there a setting that controls this...please help – vaibhav misra Jun 24 '13 at 14:17
  • Wow, no solution? – Augie Gardner Jan 25 '17 at 14:07
0

I was able to get the fix at least for my problem. I am using Remote Web Driver class and there is an option to provide timeout and browser_timeout parameters on the command line when the hub is started. Setting the value to 0 means the hub will wait indefinitely. For this scenario i wanted that only.

vaibhav misra
  • 135
  • 6
  • 19
-2
while 1==1:
    pass

This will put your code into a loop, browser will stay responsive, and you ultimately kill the python program with control C. Just did this for the scripting of logging on to an application with encrypted credentials stored locally. This keeps plain text user ids and passwords out of the scripting code.

bReimers
  • 87
  • 5