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

Is there a way to skip teardown for each test? #1228

Answered by mdmintz
varun-pandurangi asked this question in Q&A
Discussion options

I've recently started using seleniumbase along with pytest. I have multiple tests that just continue on one browser session. But I see at the end of each test function, it automatically closes the driver at the end of test. I would like to close the driver only at the class level and not at the test level. How can I do this ?

And is there any example code with seleniumbase setup and teardown methods (@Class, @function, @session) as python fixtures, so that it can be a good reference for beginners.

Thanks for such a great library.

You must be logged in to vote

Hi @varun-pandurangi You can reuse the browser session by adding --reuse-session or --rs to your pytest run command. That will keep the same session open for all tests. If you want to close the session between different classes of tests, use --reuse-class-session or --rcs.

For SeleniumBase as a pytest fixture, see syntax formats 3 and 4 from https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/syntax_formats.md

Replies: 1 comment

Comment options

Hi @varun-pandurangi You can reuse the browser session by adding --reuse-session or --rs to your pytest run command. That will keep the same session open for all tests. If you want to close the session between different classes of tests, use --reuse-class-session or --rcs.

For SeleniumBase as a pytest fixture, see syntax formats 3 and 4 from https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/syntax_formats.md

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 によって変換されたページ (->オリジナル) /