Skip to content

Commit e5281a1

Browse files
committed
Update examples
1 parent 992d940 commit e5281a1

File tree

8 files changed

+46
-16
lines changed

8 files changed

+46
-16
lines changed

examples/offline_examples/test_demo_page.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ def test_demo_page(self):
3434
try:
3535
self.hover_and_click("#myDropdown", "#dropOption2", timeout=1)
3636
except Exception:
37-
# Someone moved the mouse while the test ran
38-
self.js_click("#dropOption2")
37+
# Someone probably moved the mouse while the test ran
38+
self.hover_and_js_click("#myDropdown", "#dropOption2")
3939
self.assert_text("Link Two Selected", "h3")
4040

4141
# Click a button and then verify the expected results

examples/raw_form_turnstile.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33

44
def open_the_form_turnstile_page(sb):
55
sb.driver.uc_open_with_reconnect(
6-
"https://seleniumbase.io/apps/form_turnstile", reconnect_time=2.5,
6+
"https://seleniumbase.io/apps/form_turnstile", reconnect_time=2.7,
77
)
88

99

1010
def click_turnstile_and_verify(sb):
11+
sb.scroll_to_bottom()
1112
sb.driver.uc_switch_to_frame("iframe")
1213
sb.driver.uc_click("span.mark")
1314
sb.highlight("img#captcha-success", timeout=3.33)

examples/raw_nopecha.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from seleniumbase import SB
2+
3+
with SB(uc=True, test=True) as sb:
4+
sb.driver.uc_open_with_reconnect("https://nopecha.com/demo/turnstile", 5)
5+
sb.driver.uc_switch_to_frame("#example-container5 iframe")
6+
sb.driver.uc_click("span.mark")
7+
8+
if sb.is_element_visible("#example-container0 iframe"):
9+
sb.switch_to_frame("#example-container0 iframe")
10+
if not sb.is_element_visible("circle.success-circle"):
11+
sb.driver.uc_click("span.mark")
12+
sb.switch_to_frame("#example-container0 iframe")
13+
sb.assert_element("circle.success-circle")
14+
sb.switch_to_parent_frame()
15+
sb.switch_to_frame("#example-container5 iframe")
16+
sb.assert_element("svg#success-icon", timeout=3)
17+
sb.switch_to_parent_frame()
18+
sb.set_messenger_theme(location="top_center")
19+
sb.post_message("Selenium wasn't detected!", duration=3)

examples/raw_pixelscan.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from seleniumbase import SB
2+
3+
with SB(uc=True, incognito=True, test=True) as sb:
4+
sb.driver.uc_open_with_reconnect("https://pixelscan.net/", 11)
5+
sb.remove_elements("jdiv") # Remove chat widgets
6+
sb.assert_text("No automation framework detected", "pxlscn-bot-detection")
7+
sb.assert_text("You are not masking your fingerprint")
8+
sb.highlight("span.text-success", loops=10)
9+
sb.sleep(1)
10+
sb.highlight("pxlscn-fingerprint-masking div", loops=10, scroll=False)
11+
sb.sleep(1)
12+
sb.highlight("div.bot-detection-context", loops=10, scroll=False)
13+
sb.sleep(3)

examples/raw_turnstile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
def open_the_turnstile_page(sb):
55
sb.driver.uc_open_with_reconnect(
6-
"https://seleniumbase.io/apps/turnstile", reconnect_time=2.5,
6+
"https://seleniumbase.io/apps/turnstile", reconnect_time=2.7,
77
)
88

99

examples/raw_uc_mode.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
from seleniumbase import SB
33

44
with SB(uc=True, test=True) as sb:
5-
sb.driver.uc_open_with_reconnect("https://top.gg/", 4)
5+
sb.driver.uc_open_with_reconnect("https://top.gg/", 5)
66
if not sb.is_text_visible("Discord Bots", "h1"):
7-
sb.get_new_driver(undetectable=True)
87
sb.driver.uc_open_with_reconnect("https://top.gg/", 5)
9-
sb.activate_demo_mode() # Highlight + show assertions
108
sb.assert_text("Discord Bots", "h1", timeout=3)
9+
sb.highlight("h1", loops=3)
10+
sb.set_messenger_theme(location="top_center")
11+
sb.post_message("Selenium wasn't detected!", duration=3)

examples/test_demo_site.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ def test_demo_site(self):
2929
try:
3030
self.hover_and_click("#myDropdown", "#dropOption2", timeout=1)
3131
except Exception:
32-
# Someone moved the mouse while the test ran
33-
self.js_click("#dropOption2")
32+
# Someone probably moved the mouse while the test ran
33+
self.hover_and_js_click("#myDropdown", "#dropOption2")
3434
self.assert_text("Link Two Selected", "h3")
3535

3636
# Click a button and then verify the expected results

examples/verify_undetected.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,11 @@ class UndetectedTest(BaseCase):
99
def test_browser_is_undetected(self):
1010
if not self.undetectable:
1111
self.get_new_driver(undetectable=True)
12-
self.driver.uc_open_with_reconnect(
13-
"https://top.gg/", reconnect_time=4
14-
)
12+
self.driver.uc_open_with_reconnect("https://top.gg/", 5)
1513
if not self.is_text_visible("Discord Bots", "h1"):
1614
self.get_new_driver(undetectable=True)
17-
self.driver.uc_open_with_reconnect(
18-
"https://top.gg/", reconnect_time=5
19-
)
15+
self.driver.uc_open_with_reconnect("https://top.gg/", 5)
2016
self.assert_text("Discord Bots", "h1", timeout=3)
21-
self.set_messenger_theme(theme="air", location="top_center")
17+
self.set_messenger_theme(location="top_center")
2218
self.post_message("Selenium wasn't detected!", duration=2.8)
2319
self._print("\n Success! Website did not detect Selenium! ")

0 commit comments

Comments
 (0)