Skip to content

Using the same SB Driver over the couse of multiple files without having to pass the Driver? #3256

Answered by mdmintz
Jediweirdo asked this question in Q&A
Discussion options

You must be logged in to vote

You can reuse the browser session for all tests using the BaseCase format by adding the --rs command-line option to pytest:

SeleniumBase/README.md

Lines 706 to 707 in 2bbb3c3

--rs | --reuse-session # (Reuse browser session for all tests.)
--rcs | --reuse-class-session # (Reuse session for tests in class.)

If you just want tests of the same class to reuse the same browser session, then add --rcs instead.

Here's a basic example:

pytest --rs

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@Jediweirdo
Comment options

@Jediweirdo
Comment options

@mdmintz
Comment options

@Jediweirdo
Comment options

@Jediweirdo
Comment options

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