API reference - Method to close browser/webdriver instance? #807
-
Apologies if this is an oversight, but looking through the API reference, I could find an API call close the browser/webdriver instance created by SeleniumBase BaseCase object Does one exist ? cheers |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @sunjeet-khokhar Creating and closing browser instances is done automatically at the start and end of tests. However, if your tests open up a new browser window using |
Beta Was this translation helpful? Give feedback.
Hi @sunjeet-khokhar Creating and closing browser instances is done automatically at the start and end of tests. However, if your tests open up a new browser window using
driver2 = self.get_new_driver()
, you can close that second driver usingdriver2.quit()
. Especially useful if your tests open up a lot of new browser windows. You should not be closing your main browser window on your own, as that will break features such as--reuse-session
/--rs
, which makes test suites run faster by reusing the same initial browser window for all tests. If using the reuse-session feature for tests that log in to sites and save login cookies, you may also want to add in the--crumbs
argument so that brow…