Is there a way to skip teardown for each test? #1228
-
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. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @varun-pandurangi You can reuse the browser session by adding 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 |
Beta Was this translation helpful? Give feedback.
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