-
I am trying to use SB, but I don't like context: from seleniumbase import SB
with SB(...) as sb:
pass Is there any way to create an instance of SB and save it to a variable? Something like that: from seleniumbase import SB
class Foo(SB):
pass
foo = Foo()
foo.uc_open(...)
foo.get_new_driver()
foo.open_new_tab()
... Of course, I can use Driver: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
For the For just the variable/object with no end code, there's the |
Beta Was this translation helpful? Give feedback.
For the
SB()
/BaseCase
formats (seen in help_docs/syntax_formats.md), there must always be a beginning AND an end. That way everything can be properly set up in the beginning, and properly closed at the end. Without a context manager format, there's no way of knowing when the end is reached. When used for website testing, the end part also includes code for generating test reports, etc.For just the variable/object with no end code, there's the
Driver()
format, which has limited functionality. TheDriver()
object expects you to close the browser on your own viadriver.quit()
(to prevent memory leaks). TheDriver()
object also expects you to handle virtual display setup and teardown on yo…