Cloudflare Turnstile solver for Playwright Python
Cloudflare Turnstile blocks most headless traffic by default. Use a Sonic-issued token from Playwright Python — pages submit cleanly without triggering the WAF managed-challenge fallback.
Runnable example
from playwright.async_api import async_playwright
from captchasonic import CaptchaSonic
async with async_playwright() as p:
browser = await p.chromium.launch()
page = await browser.new_page()
await page.goto('https://target.example.com/login')
sonic = CaptchaSonic('YOUR_API_KEY')
result = sonic.solve(
type='TurnstileTaskProxyless',
website_url=page.url,
website_key='0x4AAAAAAA...',
)
await page.evaluate(
"(t) => document.querySelector('[name=cf-turnstile-response]').value = t",
result.token,
)
await page.click('form button[type=submit]')Replace YOUR_API_KEY with a real key from your dashboard. The token is good for one form submission.
FAQ
- Does Turnstile detect Playwright by default?
- Cloudflare Turnstile scores based on TLS fingerprint, JS-execution timing, and a handful of browser entropy signals. A bare Playwright session triggers the managed-challenge fallback on protected paths; the Sonic token sidesteps the scoring step.
- Where does the cf-turnstile-response field live?
- Turnstile injects a hidden input with name="cf-turnstile-response" into the form. If you embed Turnstile via the JS render API instead of declarative HTML, you set the value via the callback parameter on render().
- What if the site uses the WAF challenge page (not Turnstile widget)?
- The same token type covers both — TurnstileTaskProxyless handles the standard widget, the WAF managed challenge page, and the silent JS-only challenge. Pass the action URL and we route to the right solver internally.
Other Cloudflare Turnstile stacks
- Cloudflare Turnstile · Puppeteer · Node.jsBypass Cloudflare Turnstile with Puppeteer in Node.js. Sonic returns the cf-turnstile-response token in under 7 seconds.
- DataDome · Playwright · PythonSolve DataDome from a Playwright Python scraper. Sonic returns the validated datadome cookie ready to inject before navigation.
- reCAPTCHA Enterprise · Playwright · PythonPass reCAPTCHA Enterprise from Playwright Python. Sonic returns an action-bound Enterprise token with high confidence scores.
- hCaptcha · Playwright · PythonSolve hCaptcha from Playwright Python with a Sonic-issued token. Drop-in for both standard and Enterprise widgets.
- Cloudflare Turnstile · HTTP / requests · PythonPass Cloudflare Turnstile from a pure-requests Python script — no headless browser. Sonic returns the cf-turnstile-response token to POST directly.
How CaptchaSonic compares for this captcha
Feature-by-feature against the four most-mentioned alternatives. Independently benchmarked; numbers refresh quarterly.
| Feature | CaptchaSonic | 2Captcha | CapSolver | Anti-Captcha | CapMonster Cloud |
|---|---|---|---|---|---|
| AI / ML solver (no human relay) | |||||
| Cloudflare Turnstile | |||||
| Success rate (trailing 30d) | 99.9% | ~95% | ~98% | ~95% | ~97% |
| Price per 1k — Turnstile | $0.50 | $1.99 | $0.80 | $1.50 | $0.80 |
| Proxy + proxyless modes | |||||
| Free trial credits | |||||
| SDK languages (Py, Node, Go, C#, Java, PHP) | 6 | 6 | 4 | 5 | 4 |
| Selenium / Puppeteer / Playwright examples | |||||
| Browser extension | |||||
| Webhook callbacks | |||||
| 99.9% uptime SLA |
Yes / No / Partial reflect publicly documented support. Pricing and solve-time figures snapshot the published rate at the time this page was last updated.
Related guides
- reCAPTCHA Solver
AI bypass for reCAPTCHA v2, v3 and Enterprise.
- hCaptcha Solver
Token solver for hCaptcha and hCaptcha Enterprise.
- Cloudflare Turnstile
Bypass Cloudflare Turnstile in under 7 seconds.
- API Docs
createTask, getTaskResult, getBalance — full reference.
- GeeTest v3 / v4
Slide, icon, space and gobang puzzles solved.
- MTCaptcha Solver
Token bypass for invisible and visible MTCaptcha.