Skip to content

API reference - Method to close browser/webdriver instance? #807

Answered by mdmintz
trivial-search asked this question in Q&A
Discussion options

You must be logged in to vote

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 using driver2.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…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mdmintz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants