Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

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

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

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

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 browser cookies are cleared out between tests that reuse a browser session.

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

AltStyle によって変換されたページ (->オリジナル) /