File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ """An example of clicking at custom CAPTCHA coordinates."""
2+ from seleniumbase import SB
3+
4+ with SB (uc = True , test = True , locale = "en" ) as sb :
5+ url = "https://www.indeed.com/"
6+ sb .activate_cdp_mode (url )
7+ sb .sleep (1 )
8+ sb .click ('[data-gnav-element-name="SignIn"] a' )
9+ sb .uc_gui_click_captcha ()
10+ sb .type ('input[type="email"]' , "test@test.com" )
11+ sb .sleep (1 )
12+ sb .click ('button[type="submit"]' )
13+ sb .sleep (3.5 )
14+ selector = 'div[class*="pass-Captcha"]'
15+ element_rect = sb .cdp .get_gui_element_rect (selector , timeout = 1 )
16+ x = element_rect ["x" ] + 32
17+ y = element_rect ["y" ] + 44
18+ sb .cdp .gui_click_x_y (x , y )
19+ sb .sleep (4.5 )
Original file line number Diff line number Diff line change 1+ """SB() without the context manager `with` block."""
2+ from seleniumbase import SB
3+
4+ sb_context = SB ()
5+ sb = sb_context .__enter__ ()
6+ sb .open ("data:text/html,<h1>Test Page</h1>" )
7+ sb .highlight ("h1" , loops = 8 )
8+ sb_context .__exit__ (None , None , None )
9+
10+ """Same example using `with`:
11+ from seleniumbase import SB
12+
13+ with SB() as sb:
14+ sb.open("data:text/html,<h1>Test Page</h1>")
15+ sb.highlight("h1", loops=8)
16+ """
You can’t perform that action at this time.
0 commit comments