Skip to content

Commit 8d9d51c

Browse files
committed
Update CDP Mode examples
1 parent 660ee46 commit 8d9d51c

File tree

6 files changed

+31
-5
lines changed

6 files changed

+31
-5
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from seleniumbase import sb_cdp
2+
3+
url = "https://seleniumbase.io/apps/turnstile"
4+
sb = sb_cdp.Chrome(url)
5+
sb.gui_click_captcha()
6+
sb.assert_element("img#captcha-success")
7+
sb.sleep(2)
8+
sb.driver.stop()
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from seleniumbase import sb_cdp
2+
3+
url = "https://gitlab.com/users/sign_in"
4+
sb = sb_cdp.Chrome(url)
5+
sb.sleep(2.2)
6+
sb.gui_click_captcha()
7+
sb.sleep(2)
8+
cf_cookie = None
9+
all_cookies = sb.get_all_cookies()
10+
for cookie in all_cookies:
11+
if cookie.name == 'cf_clearance':
12+
cf_cookie = cookie
13+
break
14+
if cf_cookie:
15+
print("cf_clearance cookie: %s" % cf_cookie.value)
16+
else:
17+
print("Didn't find the cf_clearance cookie!")
18+
sb.driver.stop()

examples/cdp_mode/raw_consecutive_c.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
with SB(uc=True, test=True) as sb:
55
url = "https://sms-man.com/login"
66
sb.activate_cdp_mode(url)
7-
sb.sleep(2)
7+
sb.sleep(2.2)
88
sb.uc_gui_click_captcha()
9-
sb.sleep(2)
9+
sb.sleep(2.2)
1010
sb.uc_gui_click_captcha()
1111
sb.sleep(2)

examples/cdp_mode/raw_gitlab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
with SB(uc=True, test=True, locale="en") as sb:
44
url = "https://gitlab.com/users/sign_in"
55
sb.activate_cdp_mode(url)
6-
sb.sleep(1)
6+
sb.sleep(2.2)
77
sb.uc_gui_click_captcha()
88
sb.assert_text("Username", '[for="user_login"]', timeout=3)
99
sb.assert_element('label[for="user_login"]')

examples/cdp_mode/raw_glassdoor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
with SB(uc=True, test=True, ad_block=True) as sb:
44
url = "https://www.glassdoor.com/Reviews/index.htm"
55
sb.activate_cdp_mode(url)
6-
sb.sleep(2)
6+
sb.sleep(2.2)
77
sb.uc_gui_click_captcha()
88
sb.highlight('[data-test="global-nav-glassdoor-logo"]')
99
sb.highlight('[data-test="site-header-companies"]')

examples/cdp_mode/raw_indeed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
with SB(uc=True, test=True) as sb:
44
url = "https://www.indeed.com/companies/search"
55
sb.activate_cdp_mode(url)
6-
sb.sleep(2)
6+
sb.sleep(2.2)
77
sb.uc_gui_click_captcha()
88
sb.sleep(1)
99
company = "NASA Jet Propulsion Laboratory"

0 commit comments

Comments
 (0)