File tree 4 files changed +24
-3
lines changed
4 files changed +24
-3
lines changed Original file line number Diff line number Diff line change 3
3
4
4
driver = Driver (uc = True , log_cdp = True )
5
5
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 )
7
8
driver .switch_to_frame ("iframe" )
8
9
driver .uc_click ("span.mark" )
9
10
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):
42
42
self .assert_url_contains ("48.87645/2.26340" )
43
43
self .save_screenshot_to_logs ()
44
44
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):
21
21
def test_display_cdp_events (self ):
22
22
if not (self .undetectable and self .uc_cdp_events ):
23
23
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 )
25
26
self .add_cdp_listener ()
26
27
self .click_turnstile_and_verify ()
27
28
self .sleep (1 )
You can’t perform that action at this time.
0 commit comments