-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
UC Mode / CDP ModeUndetected Chromedriver Mode / CDP ModeUndetected Chromedriver Mode / CDP ModeenhancementMaking things betterMaking things better
Description
Add gui_click_captcha()
to the pure CDP formats
Eg, when complete, a script that uses that may look something like this:
from seleniumbase import sb_cdp
url = "https://seleniumbase.io/apps/turnstile"
sb = sb_cdp.Chrome(url)
sb.gui_click_captcha()
sb.assert_element("img#captcha-success")
sb.sleep(2)
sb.driver.stop()
Or maybe something more advanced like this:
from seleniumbase import sb_cdp
url = "https://gitlab.com/users/sign_in"
sb = sb_cdp.Chrome(url)
sb.sleep(2.2)
sb.gui_click_captcha()
sb.sleep(2)
cf_cookie = None
all_cookies = sb.get_all_cookies()
for cookie in all_cookies:
if cookie.name == 'cf_clearance':
cf_cookie = cookie
break
if cf_cookie:
print("cf_clearance cookie: %s" % cf_cookie.value)
else:
print("Didn't find the cf_clearance cookie!")
sb.driver.stop()
You may need to add sleep time for the page to fully load before calling gui_click_captcha()
.
(Since the CAPTCHA is hidden behind Shadow-DOM, we can't see when the Turnstile is ready to be clicked, but we can still click it.)
Metadata
Metadata
Assignees
Labels
UC Mode / CDP ModeUndetected Chromedriver Mode / CDP ModeUndetected Chromedriver Mode / CDP ModeenhancementMaking things betterMaking things better