Skip to content

Commit c4a7996

Browse files
committed
Update CDP Mode examples
1 parent 7e28edc commit c4a7996

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

examples/cdp_mode/raw_cf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
"""Using CDP Mode with PyAutoGUI to bypass CAPTCHAs."""
22
from seleniumbase import SB
33

4-
with SB(uc=True, test=True, locale="en", guest=True) as sb:
4+
with SB(uc=True, test=True, guest=True) as sb:
55
url = "https://www.cloudflare.com/login"
66
sb.activate_cdp_mode(url)
77
sb.sleep(3)
88
sb.uc_gui_handle_captcha() # PyAutoGUI press Tab and Spacebar
99
sb.sleep(3)
1010

11-
with SB(uc=True, test=True, locale="en", guest=True) as sb:
11+
with SB(uc=True, test=True, guest=True) as sb:
1212
url = "https://www.cloudflare.com/login"
1313
sb.activate_cdp_mode(url)
1414
sb.sleep(4)

examples/cdp_mode/raw_cf_captcha.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
with SB(uc=True, test=True, guest=True) as sb:
44
url = "https://www.cloudflare.com/login"
55
sb.activate_cdp_mode(url)
6-
sb.sleep(3)
6+
sb.wait_for_element('div[data-testid*="challenge-widget"]')
7+
sb.sleep(1.5)
78
sb.solve_captcha()
89
sb.sleep(3)

examples/raw_cf.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
"""SB Manager using CDP Mode for bypassing CAPTCHAs."""
22
from seleniumbase import SB
33

4-
with SB(uc=True, test=True, locale="en", guest=True) as sb:
4+
with SB(uc=True, test=True, guest=True) as sb:
55
url = "https://www.cloudflare.com/login"
66
sb.activate_cdp_mode(url)
7-
sb.sleep(4)
7+
sb.wait_for_element('div[data-testid*="challenge-widget"]')
8+
sb.sleep(1.5)
89
sb.solve_captcha()
9-
sb.sleep(2.5)
10+
sb.sleep(3)

0 commit comments

Comments
 (0)