Skip to content
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

Can't click interactive turnstile with Camoufox like patchright #150

Open
D4Vinci opened this issue Dec 30, 2024 · 0 comments
Open

Can't click interactive turnstile with Camoufox like patchright #150

D4Vinci opened this issue Dec 30, 2024 · 0 comments
Labels
detection-issue Potential leak in Camoufox.

Comments

@D4Vinci
Copy link
Contributor

D4Vinci commented Dec 30, 2024

Hey mate, there is this new script that can click interactive turnstile captcha: https://github.com/Xewdy444/CF-Clearance-Scraper
I tested it on https://sergiodemo.com/security/challenge/legacy-challenge and it worked
The main version uses Patchright and there's another one with nodriver. Both can only bypass it in headed mode.

The thing is I tried to make a version that does this with Camoufox but it doesn't work, here's my research results:

  1. Because the script depends on clicking on specific hard-coded dimensions on the page, it needs the browser to show with the default viewport/window size of Playwright's Chrome.
    I searched it and found it's OS dependent so for my MacOS it's {'width': 1280, 'height': 720}. I used the attribute window=(width, height) of Camoufox but the window keeps opening in different sizes every time.
    So I used the screen argument as well like this screen=Screen(max_width=width, min_width=width, max_height=height, min_height=height) and the window now opens in the same size but still something doesn't look right.
    So I added another test:
    print(self.page.viewport_size)
    print(self.page.evaluate("({ width: window.innerWidth, height: window.innerHeight })"))
    and it turns out the height on the second print is always wrong!
  2. The page takes more time to load than Patchright and about double the time for the captcha spinner to disappear, something seems really off with the page on Camoufox. I think browserforge fingerprints are missing something, I was using it on Scrapling to inject headers to raw playwright and I had many issues with normal websites not loading that don't have protections and recaptcha not loading. In the end, it turns out the format used in browserforge headers is very old and different than the one used in Chrome now so just disabling it made all those websites load correctly.

With Camoufox the function called solve_challenge doesn't work at all no matter how I optimize it for Camoufox, it doesn't detect any of the elements.

I guess all this problem revolves around Camoufox taking too much control over what's happening without too many options for the user to control the behavior. I don't know.

Last month I made a script to click the turnstile interactive captcha the same way but depending on OpenCV for the dimensions and Camoufox as a browser but I had a big issue with the mouse click not registering and I think this happens here too. Maybe Camoufox handles nested iframes very differently than Patchright?

@D4Vinci D4Vinci added the detection-issue Potential leak in Camoufox. label Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
detection-issue Potential leak in Camoufox.
Projects
None yet
Development

No branches or pull requests

1 participant