File tree Expand file tree Collapse file tree 4 files changed +24
-3
lines changed Expand file tree Collapse file tree 4 files changed +24
-3
lines changed Original file line number Diff line number Diff line change 33
44driver = Driver (uc = True , log_cdp = True )
55try :
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 )
Original file line number Diff line number Diff line change 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 )
Original file line number Diff line number Diff 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 )
Original file line number Diff line number Diff 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 )
You can’t perform that action at this time.
0 commit comments