-
I am using SB within a class and it is being generated as a global object within a class and then used by different methods. Now in certain conditions (when my browser got detected as a bot), I want to force the close of the current open one, before recreating a new one. However, I cannot figure out a way to do that. I wrote a simple script instead of getting all my class here, but the logic should be the same
Shouldnt it have exit() method ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
That's not one of the officially supported SeleniumBases Syntax Formats.
Eg. from seleniumbase import SB
with SB() as sb:
sb.open("seleniumbase.io/simple/login")
sb.type("#username", "demo_user")
sb.type("#password", "secret_pass")
sb.click('a:contains("Sign in")')
sb.assert_exact_text("Welcome!", "h1")
sb.assert_element("img#image1")
sb.highlight("#image1")
sb.click_link("Sign out")
sb.assert_text("signed out", "#top_message") |
Beta Was this translation helpful? Give feedback.
That's not one of the officially supported SeleniumBases Syntax Formats.
SB()
must be used within a Python context manager (using thewith
statement).Eg.