hCaptcha solver for Selenium Python
Solve hCaptcha from Selenium Python in two API calls. Token injection works in headless and headed Chrome / Firefox alike.
Runnable example
from captchasonic import CaptchaSonic
from selenium import webdriver
driver = webdriver.Chrome()
driver.get('https://accounts.hcaptcha.com/demo')
sonic = CaptchaSonic('YOUR_API_KEY')
result = sonic.solve(
type='HCaptchaTaskProxyless',
website_url=driver.current_url,
website_key='10000000-ffff-ffff-ffff-000000000001',
)
driver.execute_script(
"""
document.querySelector('[name=h-captcha-response]').value = arguments[0];
document.querySelector('[name=g-recaptcha-response]').value = arguments[0];
""",
result.token,
)
driver.find_element('css selector', 'form button[type=submit]').click()Replace YOUR_API_KEY with a real key from your dashboard. The token is good for one form submission.
FAQ
- Does Selenium need undetected-chromedriver for hCaptcha?
- For standard hCaptcha — usually no, the token approach avoids the fingerprint check. For Enterprise hCaptcha on aggressive sites, undetected-chromedriver helps the surrounding session blend in.
- Where do I find the websiteKey?
- Inspect the page for the [data-sitekey] attribute on the h-captcha div, or search the page source for "sitekey" — it's a UUID-shaped string.
- Why set both h-captcha-response and g-recaptcha-response?
- hCaptcha is a drop-in replacement for reCAPTCHA; many backends still read the legacy g-recaptcha-response field. Setting both covers either implementation without behavioral risk.
Other hCaptcha stacks
- reCAPTCHA v2 · Selenium · PythonStep-by-step guide: solve Google reCAPTCHA v2 in a Selenium Python automation. Returns a valid gRecaptchaResponse token in under 3 seconds.
- hCaptcha · Puppeteer · Node.jsBypass hCaptcha in Puppeteer Node.js scripts with a Sonic-issued token. Drop-in replacement for the manual click flow.
- FunCaptcha (Arkose) · Selenium · PythonSolve FunCaptcha / Arkose Labs Enterprise from Selenium Python with a Sonic-issued token. Handles rotation, image-pick, and 3D match-the-shape puzzles.
- hCaptcha · Playwright · PythonSolve hCaptcha from Playwright Python with a Sonic-issued token. Drop-in for both standard and Enterprise widgets.
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.