Failing Cloudflare Turnstile with Camoufox
Hi, thanks for this wonderful repo. I stumbled upon it here. I'm unable to pass Cloudflare Turnstile using it + Camoufox. Any help would be appreciated.
URL: https://www.paykidz.com/search (redirects to https://www.paykidz.com/auth, which has the turnstile, and then redirects back to https://www.paykidz.com/search after successful completion).
Locally, on my Mac with Chrome, I don't need to click anything and it goes through automatically. However, if I enable the dev tools and toggle the device toolbar (to simulate a mobile device), Cloudflare makes me click the checkbox and it fails when I click. With Camoufox, if I click the checkbox myself, it also fails. All this to say, I have yet to see a case where it passes if it forces you to click.
[[package]]
name = "camoufox"
version = "0.4.11"
[[package]]
name = "playwright-captcha"
version = "0.1.1"
name = "playwright"
version = "1.48.0"
My Camoufox testing was done locally on my macOS 26.3 (25D125). I use Camoufox successfully in production for reCAPTCHA on a Mac node in CA, but my testing was done locally (I'm currently based in Paris).
async with AsyncCamoufox(
os='macos',
# geoip commented out because I don't have the additional package installed, but I use Camoufox successfully in production on a few sites.
# geoip=True,
main_world_eval=True, # add this
addons=[os.path.abspath(ADDON_PATH)], # add this
headless=False,
humanize=True,
) as browser:
page: Page = await browser.new_page(extra_http_headers={'accept-encoding': 'gzip, deflate'}) # type: ignore
try:
async with ClickSolver(framework=FrameworkType.CAMOUFOX, page=page) as solver:
await page.goto('https://www.paykidz.com/search')
await solver.solve_captcha(
captcha_container=page,
captcha_type=CaptchaType.CLOUDFLARE_TURNSTILE,
)
...
With this setup, it doesn't click the checkbox AFAICT. Please advise.
Hi, thanks for this wonderful repo. I stumbled upon it here. I'm unable to pass Cloudflare Turnstile using it + Camoufox. Any help would be appreciated.
URL: https://www.paykidz.com/search (redirects to https://www.paykidz.com/auth, which has the turnstile, and then redirects back to https://www.paykidz.com/search after successful completion).
Locally, on my Mac with Chrome, I don't need to click anything and it goes through automatically. However, if I enable the dev tools and toggle the device toolbar (to simulate a mobile device), Cloudflare makes me click the checkbox and it fails when I click. With Camoufox, if I click the checkbox myself, it also fails. All this to say, I have yet to see a case where it passes if it forces you to click.
[[package]] name = "camoufox" version = "0.4.11" [[package]] name = "playwright-captcha" version = "0.1.1" name = "playwright" version = "1.48.0"My Camoufox testing was done locally on my macOS 26.3 (25D125). I use Camoufox successfully in production for reCAPTCHA on a Mac node in CA, but my testing was done locally (I'm currently based in Paris).
async with AsyncCamoufox( os='macos', # geoip commented out because I don't have the additional package installed, but I use Camoufox successfully in production on a few sites. # geoip=True, main_world_eval=True, # add this addons=[os.path.abspath(ADDON_PATH)], # add this headless=False, humanize=True, ) as browser: page: Page = await browser.new_page(extra_http_headers={'accept-encoding': 'gzip, deflate'}) # type: ignore
try: async with ClickSolver(framework=FrameworkType.CAMOUFOX, page=page) as solver: await page.goto('https://www.paykidz.com/search') await solver.solve_captcha( captcha_container=page, captcha_type=CaptchaType.CLOUDFLARE_TURNSTILE, ) ...With this setup, it doesn't click the checkbox AFAICT. Please advise.
found any solution?
No, unfortunately. I'll keep you posted if I do.
No, unfortunately. I'll keep you posted if I do.
currently using https://github.com/mjlescano/playcha works for me
Hi, sorry for the late response.
This issue has been fixed in version 0.1.2. The ClickSolver now clicks the checkbox on the specified website.
The problem was that there were multiple closed shadow roots, but we were only opening the outer one. Now all of them are opened.
To update:
pip install --upgrade playwright-captcha
The Camoufox + Playwright combo breaks down on Turnstile because even with realistic browser fingerprinting, the challenge still detects the automation layer through behavioral signals and timing.
An alternative that sidesteps the fingerprint arms race: call a solver API that runs the browser on its own warm hardware and returns the token.
curl -X POST https://api.useagentstore.com/solve \
-H "Authorization: Bearer demo" \
-H "Content-Type: application/json" \
-d '{"type":"turnstile","url":"https://www.paykidz.com/auth","sitekey":"<data-sitekey from the widget>"}'
# → { "success": true, "token": "0.abc...", "solvedInMs": 2100 }
Then submit the token as the cf-turnstile-response field in your form POST. P95 under 2.2s, no local browser needed.
Docs + SDK: https://useagentstore.com/docs
Hi @techinz, sorry for the delay. Thanks so much for fixing! I'll take a look soon and report back. Thanks again.
Hi @techinz, thanks again for the fix, and sorry (again) for the delayed follow-up. I retested with playwright-captcha==0.1.5. I can confirm that the solver now finds and clicks the checkbox on PayKidz. However, Cloudflare still displays “Verification failed”, and the site remains on the authentication page.
The target is still https://www.paykidz.com/search, which redirects to /auth. Successful verification should return the browser to /search.
Both test machines used:
Python: 3.12.6
camoufox package: 0.5.6
Camoufox browser: 152.0.4-beta.27
playwright: 1.48.0
Architecture: arm64
The browser version above is the value returned by camoufox.pkgman.installed_verstr(), separate from the Python package version.
These are the runs I performed:
| Machine | macOS | playwright-captcha | GeoIP option | Result | Elapsed time |
|---|---|---|---|---|---|
| Local Mac | 26.6.2 (25G83) | 0.1.4 | Unset | Verification failed | 35.6 s |
| Local Mac | 26.6.2 (25G83) | 0.1.5 | Unset | Verification failed | 34.4 s |
| Cloud Mac | 14.8.9 (23J631) | 0.1.5 | Unset | Verification failed | 33.6 s |
| Cloud Mac | 14.8.9 (23J631) | 0.1.5 | True |
Verification failed | 33.5 s |
Each row represents a fresh headed browser session with two solver attempts (max_attempts=2, five seconds between attempts). The times are for the entire harness run, including browser launch and cleanup. No proxy or saved browser state was configured. The GeoIP run included the geoip2 dependency and successfully downloaded its databases. These were separate runs; the solvers did not run concurrently on the same machine.
In every run:
- Navigation reached
https://www.paykidz.com/auth. - The solver detected one checkbox in one Cloudflare iframe and reported that it was ready.
- The solver logged
Checkbox clicked successfullyon both attempts. - The final screenshot showed Cloudflare's red “Verification failed” message with a “Troubleshoot” link.
- The solver raised
CaptchaDetectionError: Cloudflare turnstile success element does not exist on the page. - The final URL remained
/auth, with the titlePayKidz - Authentication.
I registered a response listener for https://api.paykidz.com/auth/token before navigation. It observed no response from that endpoint, and the harness captured no access_token. Consequently, the authenticated API checks in the original harness were never reached. No account credentials were submitted; the failure is reproducible on the public authentication page alone.
Relevant log excerpt from the 0.1.5 run:
INFO:playwright_captcha.solvers.base_solver:Applying Camoufox optimizations...
INFO:playwright_captcha.solvers.base_solver:Applying add_init_script workaround for Camoufox...
INFO:playwright_captcha.solvers.base_solver:Camoufox workaround applied
INFO:playwright_captcha.solvers.base_solver:Solving cloudflare_turnstile captcha, attempt 1/2
INFO:playwright_captcha.solvers.click.cloudflare.solve_by_click:Starting Cloudflare turnstile challenge solving by click...
INFO:playwright_captcha.solvers.click.cloudflare.utils.dom_helpers:Found 1 checkboxes in 1 Cloudflare iframes
INFO:playwright_captcha.solvers.click.cloudflare.utils.dom_helpers:Checkbox input is ready to be clicked
INFO:playwright_captcha.solvers.click.cloudflare.solve_by_click:Found checkbox in Cloudflare iframe
INFO:playwright_captcha.solvers.click.cloudflare.solve_by_click:Checkbox clicked successfully
ERROR:playwright_captcha.solvers.base_solver:Error solving cloudflare_turnstile captcha on attempt 1: Cloudflare turnstile success element does not exist on the page.
The traceback follows this path (environment-specific directory prefixes removed):
playwright_captcha/solvers/base_solver.py:350, in solve_captcha
return await self._solve_captcha_once(captcha_container, captcha_type, **kwargs)
playwright_captcha/solvers/click/click_solver.py:51, in _solve_captcha_once
await solver(framework=self.framework, page=self.page, captcha_container=captcha_container, **kwargs)
playwright_captcha/captchas/cloudflare_turnstile/solvers/click.py:31, in solve_cloudflare_turnstile_click
await solve_cloudflare_by_click(...)
playwright_captcha/solvers/click/cloudflare/solve_by_click.py:101, in solve_cloudflare_by_click
raise CaptchaDetectionError("Cloudflare turnstile success element does not exist on the page.")
playwright_captcha.utils.exceptions.CaptchaDetectionError: Cloudflare turnstile success element does not exist on the page.
The second attempt produced the same click log and exception. The exception was raised before the outer 100-second timeout expired.
Below is an authentication-only reproduction extracted from the test harness. It retains the browser options, navigation, solver settings, and timeouts used in the tests, and prints token presence rather than token values. The original runs with GeoIP disabled omitted the option; this script explicitly sets it to False unless --geoip is passed.
"""Authentication-only reproduction; no credentials or token values are printed."""
import asyncio
import importlib.metadata
import json
import logging
import sys
from camoufox.async_api import AsyncCamoufox
from camoufox.pkgman import installed_verstr
from playwright_captcha import CaptchaType, ClickSolver, FrameworkType
from playwright_captcha.utils.camoufox_add_init_script.add_init_script import get_addon_path
async def main():
logging.basicConfig(level=logging.INFO)
use_geoip = '--geoip' in sys.argv
result = {
'versions': {
name: importlib.metadata.version(name)
for name in ('camoufox', 'playwright', 'playwright-captcha')
},
'browser': installed_verstr(),
'geoip': use_geoip,
'auth_responses': [],
}
async with AsyncCamoufox(
os='macos',
headless=False,
humanize=True,
geoip=use_geoip,
main_world_eval=True,
addons=[get_addon_path()],
) as browser:
page = await browser.new_page(extra_http_headers={'accept-encoding': 'gzip, deflate'})
page.set_default_timeout(15_000)
async def on_response(response):
if response.url == 'https://api.paykidz.com/auth/token':
observation = {'status': response.status}
result['auth_responses'].append(observation)
try:
data = await response.json()
observation['has_access_token'] = bool(data.get('access_token'))
except Exception as exc:
observation['parse_error'] = type(exc).__name__
page.on('response', on_response)
async with ClickSolver(
framework=FrameworkType.CAMOUFOX,
page=page,
max_attempts=2,
attempt_delay=5,
) as solver:
try:
async with asyncio.timeout(100):
await page.goto(
'https://www.paykidz.com/search',
wait_until='domcontentloaded',
)
await page.locator('iframe').first.wait_for()
await solver.solve_captcha(
captcha_container=page,
captcha_type=CaptchaType.CLOUDFLARE_TURNSTILE,
)
await page.wait_for_url('https://www.paykidz.com/search', timeout=15_000)
except Exception as exc:
result['solver_error'] = f'{type(exc).__name__}: {exc}'
result['url'] = page.url
result['title'] = await page.title()
result['body'] = await page.locator('main').inner_text()
await page.screenshot(path='paykidz-turnstile.png')
print(json.dumps(result, indent=2))
asyncio.run(main())
For a separate reproduction environment using uv, save the script as reproduce.py and run:
uv venv --python 3.12.6 .venv-repro
uv pip install --python .venv-repro/bin/python \
'camoufox[geoip]==0.5.6' 'playwright==1.48.0' 'playwright-captcha==0.1.5'
# On a separate test machine, install/select the browser build used above:
.venv-repro/bin/python -m camoufox fetch official/152.0.4-beta.27
.venv-repro/bin/python -m camoufox set official/stable/152.0.4-beta.27
.venv-repro/bin/python reproduce.py
.venv-repro/bin/python reproduce.py --geoip
The script saves paykidz-turnstile.png. I also have screenshots and full logs from the runs above.
My interpretation is that the original checkbox-discovery problem is fixed, while the remaining failure occurs during verification. The screenshot confirms that the page itself reports a failed verification. I haven't established why Cloudflare rejects it, or whether the missing-success-element exception points to an additional DOM-handling issue. I haven't collected a Turnstile error code or a HAR, and I haven't repeated this PayKidz test with newer Playwright versions or another Camoufox browser build.
Are there browser/Playwright versions or Camoufox options you recommend for this case? Would the next useful diagnostic be the Turnstile error code, the iframe's shadow DOM after the click, or a network trace? Happy to provide whichever would help. Thanks again!
Hi, sorry for the late reply. Just had time to check your issue and it appears that the website is down now?
Hi @techinz, I just tried the site and it worked for me (with VPN). Note that it blocks on foreign IP (i.e., it requires USA IP) so may require a VPN for you to test.