Skip to content
Programmatic guide

Cloudflare Turnstile solver for Puppeteer Node.js

Pair Puppeteer with Sonic to clear Cloudflare Turnstile without rendering the widget. Works inside the WAF managed-challenge fallback and the silent JS-only mode.

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://target.example.com/login')

const sonic = new CaptchaSonic('YOUR_API_KEY')
const { token } = await sonic.solve({
  type: 'TurnstileTaskProxyless',
  websiteURL: page.url(),
  websiteKey: '0x4AAAAAAA...',
})

await page.evaluate(
  (t) => { document.querySelector('[name=cf-turnstile-response]').value = t },
  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 Cloudflare detect Puppeteer immediately?
Default Puppeteer sessions trigger Cloudflare's bot-shield within a couple of requests. Stealth plugins help with TLS / navigator markers; a Sonic token handles the captcha challenge itself.
How fast is Turnstile via Sonic + Puppeteer?
End-to-end solve is 4–7 seconds in production. The Puppeteer round-trip itself is dominated by page navigation; the captcha hop adds minimal extra latency.
What if I don't know the sitekey?
Inspect the page for cf-turnstile or [data-sitekey] elements. For pages that load Turnstile via JS, search the document for "0x4" — that's the Turnstile sitekey prefix.

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)
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)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