Skip to content

Puppeteer (Node.js) Module

Uses Puppeteer to automatically solve CAPTCHAs. Supports image clicking, slider dragging, and other CAPTCHA types.

Latest Version

Module VersionDownloadChanges
0.10.1Initial release

Installation

bash
npm install puppeteer

Copy the capguru folder into your project.

Usage

Import CaptchaSolver from the package. Pass the page containing the CAPTCHA along with your API key. Call the appropriate CAPTCHA-solving method. Allow a few seconds for the CAPTCHA interaction to complete.

javascript
const puppeteer = require('puppeteer');
const { CaptchaSolver } = require('./capguru');

(async () => {
  const browser = await puppeteer.launch({ headless: false });
  const page = await browser.newPage();
  await page.goto('https://example.com/with-captcha');

  const solver = new CaptchaSolver({
    page,
    apiKey: 'YOUR_CAPGURU_API_KEY',
    debug: true,
    attempts: 5,
  });

  await solver.solveRecaptcha2();
  await browser.close();
})();

Call the Appropriate Method

  await solver.solveRecaptcha2();
  // await solver.solveHcaptcha();
  // await solver.solveOther();
  // await solver.solveGeetest();
  // await solver.solveFuncaptcha();
  // await solver.solveTiktok();

Supported CAPTCHA Types

reCaptcha2FunCaptchaTikTokGeeTesthCaptchaOther
YesYesYesYesYesYes

Constructor Parameters

ParameterTypeDefaultDescription
pagePagePuppeteer page instance
apiKeystringCap.Guru API key
serverstring'https://api.cap.guru'API server URL
attemptsnumber5Max number of solving attempts
debugbooleanfalseEnable debug logging
selectorstring''CSS selector for the CAPTCHA container

Requirements

  • Node.js ? 18
  • Puppeteer ? 23

Error Handling

All solvers throw an Error on failure:

javascript
try {
  await solver.solveRecaptcha2();
} catch (e) {
  if (e.message.includes('ERROR_CAPTCHA_UNSOLVABLE')) {
    console.log('CAPTCHA could not be solved after all attempts');
  }
}