11from seleniumbase import SB
22
3-
4- def open_the_form_turnstile_page (sb ):
5- sb .driver .uc_open_with_reconnect (
6- "https://seleniumbase.io/apps/form_turnstile" , reconnect_time = 2.7 ,
7- )
8-
9-
10- def click_turnstile_and_verify (sb ):
11- sb .scroll_to_bottom ()
12- sb .driver .uc_switch_to_frame ("iframe" )
13- sb .driver .uc_click ("span.mark" )
14- sb .highlight ("img#captcha-success" , timeout = 3.33 )
15-
16-
173with SB (uc = True , test = True ) as sb :
18- open_the_form_turnstile_page (sb )
19- try :
20- click_turnstile_and_verify (sb )
21- except Exception :
22- open_the_form_turnstile_page (sb )
23- click_turnstile_and_verify (sb )
4+ sb .driver .uc_open_with_reconnect ("seleniumbase.io/apps/form_turnstile" , 3 )
245 sb .press_keys ("#name" , "SeleniumBase" )
256 sb .
press_keys (
"#email" ,
"[email protected] " )
267 sb .press_keys ("#phone" , "1-555-555-5555" )
@@ -30,6 +11,9 @@ def click_turnstile_and_verify(sb):
3011 sb .click ('span:contains("9:00 PM")' )
3112 sb .highlight_click ('input[value="AR"] + span' )
3213 sb .click ('input[value="cc"] + span' )
14+ sb .switch_to_frame ("iframe" )
15+ sb .driver .uc_click ("span.mark" )
16+ sb .highlight ("img#captcha-success" , timeout = 3 )
3317 sb .highlight_click ('button:contains("Request & Pay")' )
3418 sb .highlight ("img#submit-success" )
3519 sb .highlight ('button:contains("Success!")' )
0 commit comments