File tree Expand file tree Collapse file tree 5 files changed +14
-38
lines changed Expand file tree Collapse file tree 5 files changed +14
-38
lines changed Original file line number Diff line number Diff line change 5
5
try :
6
6
url = "seleniumbase.io/apps/turnstile"
7
7
driver .uc_open_with_reconnect (url , 2 )
8
- driver .switch_to_frame ("iframe" )
9
- driver .uc_click ("span" )
8
+ driver .uc_gui_handle_cf ()
10
9
driver .sleep (3 )
11
10
pprint (driver .get_log ("performance" ))
12
11
finally :
Original file line number Diff line number Diff line change 2
2
3
3
with SB (uc = True , test = True ) as sb :
4
4
url = "seleniumbase.io/apps/form_turnstile"
5
- sb .driver . uc_open_with_reconnect (url , 2 )
5
+ sb .uc_open_with_reconnect (url , 2 )
6
6
sb .press_keys ("#name" , "SeleniumBase" )
7
7
sb .press_keys ("#email" , "test@test.test" )
8
8
sb .press_keys ("#phone" , "1-555-555-5555" )
12
12
sb .click ('span:contains("9:00 PM")' )
13
13
sb .highlight_click ('input[value="AR"] + span' )
14
14
sb .click ('input[value="cc"] + span' )
15
- sb .switch_to_frame ("iframe" )
16
- sb .driver . uc_click ( "span" )
15
+ sb .scroll_to ("iframe" )
16
+ sb .uc_gui_handle_cf ( )
17
17
sb .highlight ("img#captcha-success" , timeout = 3 )
18
18
sb .highlight_click ('button:contains("Request & Pay")' )
19
19
sb .highlight ("img#submit-success" )
Original file line number Diff line number Diff line change 1
1
from seleniumbase import SB
2
2
3
3
with SB (uc = True , test = True ) as sb :
4
- sb .driver .uc_open_with_reconnect ("nopecha.com/demo/turnstile" , 4 )
5
- if sb .is_element_visible ("#example-container0 iframe" ):
6
- sb .switch_to_frame ("#example-container0 iframe" )
7
- if not sb .is_element_visible ("circle.success-circle" ):
8
- sb .driver .uc_click ("span" , reconnect_time = 3 )
9
- sb .switch_to_frame ("#example-container0 iframe" )
10
- sb .switch_to_default_content ()
11
-
12
- sb .switch_to_frame ("#example-container5 iframe" )
13
- sb .driver .uc_click ("span" , reconnect_time = 2.5 )
14
- sb .switch_to_frame ("#example-container5 iframe" )
15
- sb .assert_element ("svg#success-icon" , timeout = 3 )
16
- sb .switch_to_parent_frame ()
4
+ sb .uc_open_with_disconnect ("nopecha.com/demo/turnstile" , 3.5 )
5
+ sb .uc_gui_press_keys ("\t \t " )
6
+ sb .sleep (3.5 )
7
+ sb .connect ()
8
+ sb .uc_gui_handle_cf ("#example-container5 iframe" )
17
9
18
10
if sb .is_element_visible ("#example-container0 iframe" ):
19
11
sb .switch_to_frame ("#example-container0 iframe" )
Original file line number Diff line number Diff line change 1
1
from seleniumbase import SB
2
2
3
-
4
- def open_the_turnstile_page (sb ):
3
+ with SB (uc = True , test = True ) as sb :
5
4
url = "seleniumbase.io/apps/turnstile"
6
- sb .driver .uc_open_with_reconnect (url , reconnect_time = 2 )
7
-
8
-
9
- def click_turnstile_and_verify (sb ):
10
- sb .driver .switch_to_frame ("iframe" )
11
- sb .driver .uc_click ("span" )
5
+ sb .uc_open_with_reconnect (url , reconnect_time = 2 )
6
+ sb .uc_gui_handle_cf ()
12
7
sb .assert_element ("img#captcha-success" , timeout = 3 )
13
-
14
-
15
- with SB (uc = True , test = True ) as sb :
16
- open_the_turnstile_page (sb )
17
- try :
18
- click_turnstile_and_verify (sb )
19
- except Exception :
20
- open_the_turnstile_page (sb )
21
- click_turnstile_and_verify (sb )
22
8
sb .set_messenger_theme (location = "top_left" )
23
9
sb .post_message ("SeleniumBase wasn't detected" , duration = 3 )
Original file line number Diff line number Diff line change @@ -13,16 +13,15 @@ def add_cdp_listener(self):
13
13
)
14
14
15
15
def click_turnstile_and_verify (sb ):
16
- sb .switch_to_frame ("iframe" )
17
- sb .driver .uc_click ("span" )
16
+ sb .uc_gui_handle_cf ()
18
17
sb .assert_element ("img#captcha-success" , timeout = 3 )
19
18
sb .highlight ("img#captcha-success" , loops = 8 )
20
19
21
20
def test_display_cdp_events (self ):
22
21
if not (self .undetectable and self .uc_cdp_events ):
23
22
self .get_new_driver (undetectable = True , uc_cdp_events = True )
24
23
url = "seleniumbase.io/apps/turnstile"
25
- self .driver . uc_open_with_reconnect (url , 2 )
24
+ self .uc_open_with_reconnect (url , 2 )
26
25
self .add_cdp_listener ()
27
26
self .click_turnstile_and_verify ()
28
27
self .sleep (1 )
You can’t perform that action at this time.
0 commit comments