'How to keep the browser open after test execution when using selenium web driver

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



Solution 1:[1]

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?

Solution 2:[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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Community
Solution 2 bReimers