CaptchaNo
[ INTEGRATION ]

Captcha solver for
Puppeteer

Resolve the challenge inside the run instead of failing the job. A working Node.js example, and the three things that decide whether your token is accepted.

Puppeteer · Node.js
import puppeteer from "puppeteer";

const CAPTCHANO_KEY = "cn-YOUR_API_KEY";

async function solve(task) {
  const headers = {
    Authorization: `Bearer ${CAPTCHANO_KEY}`,
    "Content-Type": "application/json",
  };
  const res = await fetch("https://api.captchano.com/v1/solve?wait=60", {
    method: "POST",
    headers,
    body: JSON.stringify(task),
  });
  let data = await res.json();
  // A solve can outlast the 60 s wait: poll the task until it finishes.
  while (data.status === "queued" || data.status === "solving") {
    await new Promise((r) => setTimeout(r, 5000));
    const poll = await fetch(`https://api.captchano.com/v1/task/${data.id}`, { headers });
    data = await poll.json();
  }
  if (data.status !== "ready") throw new Error(JSON.stringify(data.error ?? data));
  return data.solution; // { token, userAgent }
}

const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto("https://example.com/signup");

const sitekey = await page.$eval("[data-sitekey]", (el) => el.getAttribute("data-sitekey"));
const { token, userAgent } = await solve({ type: "turnstile", sitekey, url: page.url() });

// Turnstile binds the token to a user agent: replay the one it was minted with.
if (userAgent) await page.setUserAgent(userAgent);
await page.evaluate((t) => {
  document.querySelector('[name="cf-turnstile-response"]').value = t;
}, token);
await page.click('button[type="submit"]');

What decides whether the token is accepted

  1. Pass your proxy through. The token should be minted behind the same exit IP that submits it. For session-graded systems this is mandatory, not an optimisation.
  2. Match the user agent. Turnstile and several anti-bot systems bind the token to a user agent. We return the one used so you can replay it exactly.
  3. Request late. Tokens expire in roughly 120 seconds. Ask for one when you are ready to submit.

Blocking or polling

The example uses ?wait=60, so the call returns the finished solve and your Puppeteer step stays linear. If you would rather not hold a connection, drop the parameter, keep the returned id, and poll GET /v1/task/{id} every five seconds. A token you have paid for stays retrievable for ten minutes, so a dropped connection does not cost you the solve.

Cost

$0.00598 per successful reCAPTCHA v2 solve, with failed solves never billed. See pricing for every challenge type, or the API reference for the full request shape.

[ HOW IT FITS ]

How the solve fits into Puppeteer

Puppeteer drives Chromium from Node.js. The solve is one fetch between page.goto and the submit click, and page.evaluate puts the token where the page expects it.

  1. 01
    Launch with your proxy

    Start Chromium with --proxy-server and set the user agent you will report to the solve.

  2. 02
    Read the sitekey

    page.$eval('[data-sitekey]', el => el.dataset.sitekey) and the callback name if present.

  3. 03
    Solve

    fetch the API with ?wait=60; the response carries the token and the user agent used.

  4. 04
    Inject and submit

    page.evaluate to write the token and fire the callback, then click submit.

Getting the token into the page

page.evaluate sets the response field and calls the callback in the page context.

[ PITFALLS ]

Where integrations usually go wrong

Proxy auth

Chromium ignores credentials in --proxy-server. Use page.authenticate for the browser and pass the full proxy URL to the solve.

Iframe widgets

The widget lives in an iframe but the response field is in the main frame. Inject in the main frame.

Stale token on retry

Tokens are single-use. If the submit fails, solve again instead of reusing the first token.

[ FAQ ]

Puppeteer captcha FAQ

Do I need puppeteer-extra or a captcha plugin?

No. A single fetch to the API and a page.evaluate call are enough, and you keep full control over when the solve happens and what it costs.

Does it work in headless mode?

Yes. The token is produced by our infrastructure, not by your browser, so headless or headed makes no difference to the solve itself. Sites may treat headless browsers with more suspicion, so passing a realistic user agent still helps.

Can I use it with Playwright for Node?

Yes. The code is almost identical; Playwright's page.evaluate and page.locator replace Puppeteer's equivalents.

How do I solve Cloudflare Turnstile in Puppeteer?

Read the sitekey from the Turnstile widget, send type turnstile with the page URL, then set the cf-turnstile-response input and call the callback if the page declares one.

[ READ NEXT ]

Guides that help

Ready to build?

Start with a free 7-day trial of the Hobby plan, then pay per successful solve or keep the plan as your traffic grows. Cancel before the trial ends and you pay nothing.

See our plans
Are you an AI agent? See setup options →