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

Enable clicking of CF checkbox in CDP Async drivers using OpenCV-based template matching #3729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

Copy link

@montovaneli montovaneli commented May 5, 2025

This PR replaces the outdated verify_cf method, adding support for locating and clicking "cf" checkboxes in CDP Async drivers by leveraging OpenCV template matching. It is based on the implementation in the nodriver package, with the following enhancements:

Language-agnostic: works regardless of the driver lang (using a 36x36 px image of a cf checkbox cfbtn)

Per-tab UUIDs: each driver tab gets a unique UUID so that multiple drivers can operate in the same execution directory without clashing over temporary screenshots.

Temporary screenshot management: screenshots are saved to the working directory using the previously UUID and cleaned up after use.

New dependency: adds opencv-python for template matching functionality.

Copy link
Member

mdmintz commented May 5, 2025

It's already possible to click the CAPTCHA without UC Mode:

from seleniumbase import sb_cdp
def main():
 url = "www.planetminecraft.com/account/sign_in/"
 sb = sb_cdp.Chrome(url, lang="en")
 sb.sleep(2)
 sb.gui_click_element("#turnstile-widget div")
 sb.sleep(2)
if __name__ == "__main__":
 main()

Also, your PR introduces a new dependency, opencv-python, which is 150 times larger than seleniumbase itself:
(Note that seleniumbase is still in kB, while opencv-python is in MB.)

Screenshot 2025年05月05日 at 10 59 38 AM

That goes in the opposite direction from what most people want, which is a slimmer package (rather than a heavier one).

Also, image-based CAPTCHA-detection is not practical, nor efficient. The image could change, or it could appear different on different systems. If there were multiple windows open at the same time, that would also be a problem.

Rather than a PR, you could create a discussion in https://github.com/seleniumbase/SeleniumBase/discussions so that if anyone else is interested in image-based CAPTCHA detection and clicking, then they could find that information there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

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