Skip to content

How can I use SB without the "with" context #2277

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

You must be logged in to vote

The Driver() format can be used without a context manager:
Eg. https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_login_driver.py

from seleniumbase import Driver

driver = Driver()
# ...
driver.quit()

However, the standard SeleniumBase formats have clear setUp() and tearDown() steps defined in BaseCase, so there needs to be a way to guarantee that tearDown() will be reached when a test is run and completes. This is done via context manager or test method.

See https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/syntax_formats.md for all 23 Syntax Formats.

Replies: 1 comment

Comment options

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
2 participants