Skip to content

Commit cd3f13f

Browse files
committed
Update examples
1 parent e214132 commit cd3f13f

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

Diff for: examples/raw_cdp_logging.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
driver = Driver(uc=True, log_cdp=True)
55
try:
6-
driver.uc_open_with_reconnect("https://seleniumbase.io/apps/turnstile")
6+
url = "seleniumbase.io/apps/turnstile"
7+
driver.uc_open_with_reconnect(url, 2)
78
driver.switch_to_frame("iframe")
89
driver.uc_click("span.mark")
910
driver.sleep(3)

Diff for: examples/raw_cookies.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""A SeleniumBase test that loads cookies to bypass login."""
2+
from seleniumbase import SB
3+
4+
# Log in to Swag Labs and save cookies
5+
with SB(test=True) as sb:
6+
sb.open("https://www.saucedemo.com")
7+
sb.wait_for_element("div.login_logo")
8+
sb.type("#user-name", "standard_user")
9+
sb.type("#password", "secret_sauce")
10+
sb.click('input[type="submit"]')
11+
sb.highlight("div.inventory_list", loops=6)
12+
sb.save_cookies(name="cookies.txt")
13+
14+
# Load previously saved cookies to bypass login
15+
with SB(test=True) as sb:
16+
sb.open("https://www.saucedemo.com")
17+
sb.load_cookies(name="cookies.txt")
18+
sb.open("https://www.saucedemo.com/inventory.html")
19+
sb.highlight("div.inventory_list", loops=12)

Diff for: examples/test_geolocation.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ def test_geolocation(self):
4242
self.assert_url_contains("48.87645/2.26340")
4343
self.save_screenshot_to_logs()
4444
if self.headed:
45-
self.sleep(2.5)
45+
self.sleep(4)

Diff for: examples/uc_cdp_events.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ def click_turnstile_and_verify(sb):
2121
def test_display_cdp_events(self):
2222
if not (self.undetectable and self.uc_cdp_events):
2323
self.get_new_driver(undetectable=True, uc_cdp_events=True)
24-
self.driver.uc_open_with_reconnect("seleniumbase.io/apps/turnstile")
24+
url = "seleniumbase.io/apps/turnstile"
25+
self.driver.uc_open_with_reconnect(url, 2)
2526
self.add_cdp_listener()
2627
self.click_turnstile_and_verify()
2728
self.sleep(1)

0 commit comments

Comments
 (0)