2525from seleniumbase import Driver
2626
2727driver = Driver(uc = True )
28- driver.uc_open_with_reconnect(" https://nowsecure.nl/#relax " , 5 )
28+ driver.uc_open_with_reconnect(" https://top.gg/ " , 6 )
2929driver.quit()
3030```
3131
@@ -35,30 +35,22 @@ driver.quit()
3535from seleniumbase import SB
3636
3737with SB(uc = True ) as sb:
38- sb.driver.uc_open_with_reconnect(" https://nowsecure.nl/#relax " , 5 )
38+ sb.driver.uc_open_with_reconnect(" https://top.gg/ " , 6 )
3939```
4040
41- 👤 Here's a longer example, which includes retries and a captcha-click failsafe for bypassing detection :
41+ 👤 Here's a longer example, which includes a retry if the CAPTCHA isn't bypassed on the first attempt :
4242
4343``` python
4444from seleniumbase import SB
4545
4646with SB(uc = True , test = True ) as sb:
47- sb.driver.uc_open_with_tab(" https://nowsecure.nl/#relax" )
48- sb.sleep(1.2 )
49- if not sb.is_text_visible(" OH YEAH, you passed!" , " h1" ):
50- sb.get_new_driver(undetectable = True )
51- sb.driver.uc_open_with_reconnect(
52- " https://nowsecure.nl/#relax" , reconnect_time = 3
53- )
54- sb.sleep(1.2 )
55- if not sb.is_text_visible(" OH YEAH, you passed!" , " h1" ):
56- if sb.is_element_visible(' iframe[src*="challenge"]' ):
57- with sb.frame_switch(' iframe[src*="challenge"]' ):
58- sb.click(" span.mark" )
59- sb.sleep(2 )
60- sb.activate_demo_mode()
61- sb.assert_text(" OH YEAH, you passed!" , " h1" , timeout = 3 )
47+ sb.driver.uc_open_with_reconnect(" https://top.gg/" , 5 )
48+ if not sb.is_text_visible(" Discord Bots" , " h1" ):
49+ sb.driver.uc_open_with_reconnect(" https://top.gg/" , 5 )
50+ sb.assert_text(" Discord Bots" , " h1" , timeout = 3 )
51+ sb.highlight(" h1" , loops = 3 )
52+ sb.set_messenger_theme(location = " top_center" )
53+ sb.post_message(" Selenium wasn't detected!" , duration = 3 )
6254```
6355
6456👤 Here's an example where clicking the checkbox is required, even for humans: (Commonly seen with forms that are CAPTCHA-protected.)
@@ -111,7 +103,7 @@ driver.uc_click(
111103 selector, by = " css selector" ,
112104 timeout = settings.SMALL_TIMEOUT , reconnect_time = None )
113105
114- driver.uc_switch_to_frame(frame)
106+ driver.uc_switch_to_frame(frame, reconnect_time = None )
115107```
116108
117109(Note that the ` reconnect_time ` is used to specify how long the driver should be disconnected from Chrome to prevent detection before reconnecting again.)
0 commit comments