samedi 5 janvier 2019

Python Selenium keep chrome open between tests

I have a class with few tests, for example:

class Example(Environment)
   def test1(self):
   def test2(self):
   def test3(self):
   def test4(self):

and class environment with setup and teardown methods

class Environment(unittest.TestCase):

    def setUp(self):
        options_for_console_log = DesiredCapabilities.CHROME
        options_for_console_log['loggingPrefs'] = {'browser': 'ALL'}
        self.driver = webdriver.Chrome(desired_capabilities=options_for_console_log)
        self.driver.maximize_window()

    def tearDown(self):
        driver = self.driver
        driver.close()

After every test chrome reopens, but i want to run it in one session. How can i do it?

Aucun commentaire:

Enregistrer un commentaire