'How not to close browser after using selenium browser?

How not to close browser after using selenium browser?

I made autologin code but want not to close the browser.



Solution 1:[1]

If your webdriver object is in a function, try making it global.
For Example:

def auto_login():
    global browser
    browser = webdriver.Safari()

    """
    rest of your 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 radioactive11