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 55try :
66 url = "seleniumbase.io/apps/turnstile"
77 driver .uc_open_with_reconnect (url , 2 )
8- driver .switch_to_frame ("iframe" )
9- driver .uc_click ("span" )
8+ driver .uc_gui_handle_cf ()
109 driver .sleep (3 )
1110 pprint (driver .get_log ("performance" ))
1211finally :
Original file line number Diff line number Diff line change 22
33with SB (uc = True , test = True ) as sb :
44 url = "seleniumbase.io/apps/form_turnstile"
5- sb .driver . uc_open_with_reconnect (url , 2 )
5+ sb .uc_open_with_reconnect (url , 2 )
66 sb .press_keys ("#name" , "SeleniumBase" )
77 sb .press_keys ("#email" , "test@test.test" )
88 sb .press_keys ("#phone" , "1-555-555-5555" )
1212 sb .click ('span:contains("9:00 PM")' )
1313 sb .highlight_click ('input[value="AR"] + span' )
1414 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 ( )
1717 sb .highlight ("img#captcha-success" , timeout = 3 )
1818 sb .highlight_click ('button:contains("Request & Pay")' )
1919 sb .highlight ("img#submit-success" )
Original file line number Diff line number Diff line change 11from seleniumbase import SB
22
33with 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" )
179
1810 if sb .is_element_visible ("#example-container0 iframe" ):
1911 sb .switch_to_frame ("#example-container0 iframe" )
Original file line number Diff line number Diff line change 11from seleniumbase import SB
22
3-
4- def open_the_turnstile_page (sb ):
3+ with SB (uc = True , test = True ) as sb :
54 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 ()
127 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 )
228 sb .set_messenger_theme (location = "top_left" )
239 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):
1313 )
1414
1515 def click_turnstile_and_verify (sb ):
16- sb .switch_to_frame ("iframe" )
17- sb .driver .uc_click ("span" )
16+ sb .uc_gui_handle_cf ()
1817 sb .assert_element ("img#captcha-success" , timeout = 3 )
1918 sb .highlight ("img#captcha-success" , loops = 8 )
2019
2120 def test_display_cdp_events (self ):
2221 if not (self .undetectable and self .uc_cdp_events ):
2322 self .get_new_driver (undetectable = True , uc_cdp_events = True )
2423 url = "seleniumbase.io/apps/turnstile"
25- self .driver . uc_open_with_reconnect (url , 2 )
24+ self .uc_open_with_reconnect (url , 2 )
2625 self .add_cdp_listener ()
2726 self .click_turnstile_and_verify ()
2827 self .sleep (1 )
You can’t perform that action at this time.
0 commit comments