25
25
from seleniumbase import Driver
26
26
27
27
driver = Driver(uc = True )
28
- driver.uc_open_with_reconnect(" https://nowsecure.nl/#relax " , 5 )
28
+ driver.uc_open_with_reconnect(" https://top.gg/ " , 6 )
29
29
driver.quit()
30
30
```
31
31
@@ -35,30 +35,22 @@ driver.quit()
35
35
from seleniumbase import SB
36
36
37
37
with 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 )
39
39
```
40
40
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 :
42
42
43
43
``` python
44
44
from seleniumbase import SB
45
45
46
46
with 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 )
62
54
```
63
55
64
56
👤 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(
111
103
selector, by = " css selector" ,
112
104
timeout = settings.SMALL_TIMEOUT , reconnect_time = None )
113
105
114
- driver.uc_switch_to_frame(frame)
106
+ driver.uc_switch_to_frame(frame, reconnect_time = None )
115
107
```
116
108
117
109
(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