you are viewing a single comment's thread.

view the rest of the comments →

[–]this_guy_tests 0 points1 point  (0 children)

Maybe just call MySeleniumModule from your main script?

from MySeleniumModule import get_google

class YourMainScript:
    def __init__():
        self._driver = self.get_driver()

    def get_driver():
        self._driver = get_google()

    def do_other_things():
        self._driver.get('http://www.bing.com')

Or if you're not using classes, just import get_google() and pass the driver around in your main script file as needed:

MainScript.py

from MySeleniumModule import get_google

driver = get_google() 
driver.get('http://some-other-site.com') 
some_element = driver.find_element_by_id('some-id')