Skip to content

Commit 8bdbb94

Browse files
committed
Update CDP Mode examples
1 parent 601f61b commit 8bdbb94

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

examples/cdp_mode/raw_antibot.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from seleniumbase import SB
2+
3+
with SB(uc=True, test=True) as sb:
4+
url = "https://seleniumbase.io/antibot/login"
5+
sb.activate_cdp_mode(url)
6+
sb.press_keys("input#username", "demo_user")
7+
sb.press_keys("input#password", "secret_pass")
8+
x, y = sb.cdp.get_gui_element_center("button#myButton")
9+
sb.uc_gui_click_x_y(x, y)
10+
sb.sleep(1.5)
11+
x, y = sb.cdp.get_gui_element_center("a#log-in")
12+
sb.uc_gui_click_x_y(x, y)
13+
sb.assert_text("Welcome!", "h1")
14+
sb.set_messenger_theme(location="bottom_center")
15+
sb.post_message("SeleniumBase wasn't detected!")
16+
sb.sleep(1.5)

examples/cdp_mode/raw_gitlab.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from seleniumbase import SB
2+
3+
with SB(uc=True, test=True, locale_code="en") as sb:
4+
url = "https://gitlab.com/users/sign_in"
5+
sb.activate_cdp_mode(url)
6+
sb.uc_gui_click_captcha()
7+
sb.assert_text("Username", '[for="user_login"]', timeout=3)
8+
sb.assert_element('label[for="user_login"]')
9+
sb.highlight('button:contains("Sign in")')
10+
sb.highlight('h1:contains("GitLab.com")')
11+
sb.post_message("SeleniumBase wasn't detected", duration=4)

0 commit comments

Comments
 (0)