Skip to content

Commit

Permalink
Update example tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mdmintz committed Sep 1, 2023
1 parent f2b9448 commit f76d81d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
7 changes: 6 additions & 1 deletion examples/raw_uc_mode.py
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -8,4 +8,9 @@
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)
8 changes: 3 additions & 5 deletions examples/uc_cdp_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@ def test_display_cdp_events(self):
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:
Expand Down
10 changes: 4 additions & 6 deletions examples/verify_undetected.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,14 @@ def test_browser_is_undetected(self):
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:
Expand Down

0 comments on commit f76d81d

Please sign in to comment.