Skip to content
Programmatic guide

hCaptcha solver for Puppeteer Node.js

Solve hCaptcha from Puppeteer in two API calls — no headed mode, no click solver, no fingerprint nuisance. Works for both standard and Enterprise widgets.

Node.js · Puppeteer

Runnable example

import puppeteer from 'puppeteer'
import { CaptchaSonic } from 'captchasonic'

const browser = await puppeteer.launch()
const page = await browser.newPage()
await page.goto('https://accounts.hcaptcha.com/demo')

const sonic = new CaptchaSonic('YOUR_API_KEY')
const result = await sonic.solve({
  type: 'HCaptchaTaskProxyless',
  websiteURL: page.url(),
  websiteKey: '10000000-ffff-ffff-ffff-000000000001',
})

await page.evaluate(
  (token) => {
    document.querySelector('[name="h-captcha-response"]').value = token
    document.querySelector('[name="g-recaptcha-response"]').value = token
  },
  result.token,
)
await page.click('button[type="submit"]')

Replace YOUR_API_KEY with a real key from your dashboard. The token is good for one form submission.

FAQ

Why two hidden fields for hCaptcha?
hCaptcha emits both h-captcha-response and g-recaptcha-response so sites that originally integrated reCAPTCHA can drop hCaptcha in with no backend change. Setting both ensures the form post validates regardless of which field the backend reads.
Can the solver handle Enterprise hCaptcha?
Yes — pass the rqdata field if the page provides one (it's embedded in the widget bootstrap JS as data-rqdata). Sonic returns a token that validates against the Enterprise verify endpoint.
Does this work with puppeteer-extra-plugin-stealth?
Yes. Stealth helps the surrounding page navigate without flagging the bot, and the Sonic token handles the captcha step. The two stack cleanly.

How CaptchaSonic compares for this captcha

Feature-by-feature against the four most-mentioned alternatives. Independently benchmarked; numbers refresh quarterly.

FeatureCaptchaSonic2CaptchaCapSolverAnti-CaptchaCapMonster 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)66454
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