Update example tests

This commit is contained in:
Michael Mintz 2023-09-01 18:25:18 -04:00
parent f2b9448686
commit f76d81d500
3 changed files with 13 additions and 12 deletions

View File

@ -1,4 +1,4 @@
"""SB Manager using "uc"-mode for evading bot-detection."""
"""SB Manager using UC Mode for evading bot-detection."""
from seleniumbase import SB
with SB(uc=True) as sb:
@ -8,4 +8,9 @@ with SB(uc=True) as sb:
sb.get_new_driver(undetectable=True)
sb.open("https://nowsecure.nl/#relax")
sb.sleep(3)
if not sb.is_text_visible("OH YEAH, you passed!", "h1"):
if sb.is_element_visible('iframe[src*="challenge"]'):
with sb.frame_switch('iframe[src*="challenge"]'):
sb.click("area")
sb.sleep(3)
sb.assert_text("OH YEAH, you passed!", "h1", timeout=3)

View File

@ -35,11 +35,9 @@ class CDPTests(BaseCase):
try:
self.verify_success()
except Exception:
if self.is_element_visible('input[value*="Verify"]'):
self.click('input[value*="Verify"]')
elif self.is_element_visible('iframe[title*="challenge"]'):
self.switch_to_frame('iframe[title*="challenge"]')
self.click("span.mark")
if self.is_element_visible('iframe[src*="challenge"]'):
with self.frame_switch('iframe[src*="challenge"]'):
self.click("area")
else:
self.fail_me()
try:

View File

@ -25,16 +25,14 @@ class UndetectedTest(BaseCase):
self.verify_success()
except Exception:
self.clear_all_cookies()
self.get_new_driver()
self.get_new_driver(undetectable=True)
self.open("https://nowsecure.nl/#relax")
try:
self.verify_success()
except Exception:
if self.is_element_visible('input[value*="Verify"]'):
self.click('input[value*="Verify"]')
elif self.is_element_visible('iframe[title*="challenge"]'):
self.switch_to_frame('iframe[title*="challenge"]')
self.click("span.mark")
if self.is_element_visible('iframe[src*="challenge"]'):
with self.frame_switch('iframe[src*="challenge"]'):
self.click("area")
else:
self.fail_me()
try: