Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add gui_click_captcha() to the pure CDP formats #3945

Closed
Assignees
Labels
UC Mode / CDP ModeUndetected Chromedriver Mode / CDP Mode enhancementMaking things better
@mdmintz

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 Mode enhancementMaking things better

Type

No type

Projects

No projects

Milestone

No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      AltStyle によって変換されたページ (->オリジナル) /