How can I use SB without the "with" context #2277
-
We have an old codebase that we are converting to SeleniumBase and we need to use the SB class without the
But I am getting error
Is it possible what I want? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The from seleniumbase import Driver
driver = Driver()
# ...
driver.quit() However, the standard SeleniumBase formats have clear See https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/syntax_formats.md for all 23 Syntax Formats. |
Beta Was this translation helpful? Give feedback.
The
Driver()
format can be used without a context manager:Eg. https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_login_driver.py
However, the standard SeleniumBase formats have clear
setUp()
andtearDown()
steps defined inBaseCase
, so there needs to be a way to guarantee thattearDown()
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.