hCaptcha solver for Playwright Python
Drop a Sonic-issued hCaptcha token into Playwright Python. Works for standard and Enterprise widgets; no widget interaction required.
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://accounts.hcaptcha.com/demo')
sonic = CaptchaSonic('YOUR_API_KEY')
result = sonic.solve(
type='HCaptchaTaskProxyless',
website_url=page.url,
website_key='10000000-ffff-ffff-ffff-000000000001',
)
await page.evaluate(
'(t) => { document.querySelector("[name=h-captcha-response]").value = t; '
'document.querySelector("[name=g-recaptcha-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
- Can Playwright + Sonic clear hCaptcha Enterprise?
- Yes. Pass the rqdata value (find it in the widget's bootstrap JS) and Sonic returns an Enterprise-valid token.
- Why set both response fields?
- hCaptcha is a drop-in replacement for reCAPTCHA. Backends that integrated reCAPTCHA before may still read g-recaptcha-response; new ones read h-captcha-response. Setting both covers either case.
- Does this work headless?
- Yes. Token injection lives in DOM, not in browser interaction history. Headless and headed Playwright sessions produce the same outcome.
Other hCaptcha stacks
- hCaptcha · Puppeteer · Node.jsBypass hCaptcha in Puppeteer Node.js scripts with a Sonic-issued token. Drop-in replacement for the manual click flow.
- Cloudflare Turnstile · Playwright · PythonPass Cloudflare Turnstile from Playwright Python. Sonic returns the cf-turnstile-response token in under 7 seconds, ready to drop into the page.
- hCaptcha · Selenium · PythonBypass hCaptcha from a Selenium Python script. Drop the Sonic token into the form's hidden field; no clicking the widget.
- 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.
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) | |||||
| hCaptcha (incl. Enterprise) | |||||
| Success rate (trailing 30d) | 99.9% | ~95% | ~98% | ~95% | ~97% |
| Price per 1k — hCaptcha | $0.90 | $2.99 | $1.20 | $2.00 | $1.50 |
| 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
- hCaptcha Solver
Token solver for hCaptcha and hCaptcha Enterprise.
- reCAPTCHA Solver
AI bypass for reCAPTCHA v2, v3 and Enterprise.
- 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.
- AWS WAF Captcha
AWS WAF token solver for the WAF-CAPTCHA challenge.