Skip to content

How to Use SeleniumBase’s sb Fixture in Class-Scoped Setup with Pytest #3390

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

You must be logged in to vote

You can override the sb class fixture in order to accomplish that. (One of the 25 Syntax Formats)

Eg. SeleniumBase/examples/test_override_sb_fixture.py

That basically lets you do anything that's allowable by pytest, while still getting access to SeleniumBase's BaseCase methods.

Note that overriding the sb fixture means replacing all default configuration in browser_launcher.py, which means special modes that are configured in browser_launcher.py (such as UC Mode, CDP Mode, etc.) won't be there anymore. Depending on what you're doing, that might not be the best option for you.

Another option would be pytest --dist=loadscope to group tests by class. (https://stackoverflow.com/a/56475200/705…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@smanenti
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