ProductsIntegrationsResourcesDocumentationPricing
Start Now

© 2026 CapSolver. All rights reserved.

CONTACT US

Slack: lola@capsolver.com

Products

  • reCAPTCHA v2
  • reCAPTCHA v3
  • Cloudflare Turnstile
  • Cloudflare Challenge
  • AWS WAF
  • Browser Extension
  • Many more CAPTCHA types

Integrations

  • Selenium
  • Playwright
  • Puppeteer
  • n8n
  • Partners
  • View All Integrations

Resources

  • Referral System
  • Documentation
  • API Reference
  • Blog
  • FAQs
  • Glossary
  • Status

Legal

  • Terms & Conditions
  • Privacy Policy
  • Refund Policy
  • Don't Sell My Info
Blog/reCAPTCHA/How to Solve reCAPTCHA v2 using Puppeteer [Javascript] with CapSolver Extension
Jul23, 2023

How to Solve reCAPTCHA v2 using Puppeteer [Javascript] with CapSolver Extension

Ethan Collins

Ethan Collins

Pattern Recognition Specialist

Introduction

Automating browser interactions often requires handling CAPTCHA challenges, especially when working with tools like Puppeteer. In this guide, we will walk through how to set up Puppeteer JS with the CapSolver browser extension to solve reCAPTCHA v2 efficiently. While this tutorial focuses on reCAPTCHA v2, the same approach can be extended to other CAPTCHA types supported by CapSolver.

By the end of this article, you will understand how to install the required dependencies, configure the CapSolver extension, and trigger CAPTCHA solving directly within a Puppeteer-controlled browser session.

1. Installing puppeteer components

⚠️ In this blog, we will explain how to set up Puppeteer JS with the CapSolver extension to solve reCAPTCHA v2. However, this approach can be applied to other CAPTCHA types as well.

Copy
npm i puppeteer puppeteer-extra puppeteer-extra-plugin-stealth

2. Setting up the extension

Download the archive with the extension, and unzip it to the folder ./CapSolver.Browser.Extension in the root of the project.

The extension has many settings, including automatic CAPTCHA solving, proxy support, and fine-grained control options. These settings are available in the file ./assets/config.json.

These settings are:

json Copy
{
    "apiKey": "YourApiKey",
    "useCapsolver": true,

    "useProxy": false,
    "proxyType": "http",
    "hostOrIp": "",
    "port": "",
    "proxyLogin": "",
    "proxyPassword": "",

    "enabledForBlacklistControl": false,
    "blackUrlList": [],

    "enabledForRecaptcha": true,
    "enabledForRecaptchaV3": true,
    "enabledForcaptcha": true,

    "reCaptchaMode": "token",
    "captchaMode": "click",

    "reCaptchaDelayTime": 0,
    "captchaDelayTime": 0,

    "reCaptchaRepeatTimes": 10,
    "reCaptcha3RepeatTimes": 10,
    "captchaRepeatTimes": 10
}

Enter your API key in the extension settings file ./assets/config.json. The key must be assigned to the apiKey field. You can copy your API key directly from the CapSolver dashboard.

Example:

Copy
apiKey: "CAP-4FDBD3SDFSD-23S-2-3"

In this example, reCaptchaMode is set to token. While click mode is also available, token mode is generally recommended for reCAPTCHA.

3. Setting up Puppeteer to solve reCAPTCHA with CapSolver Extension

Copy
const puppeteer = require('puppeteer-extra');
const StealthPlugin = require('puppeteer-extra-plugin-stealth');
const { executablePath } = require('puppeteer'); 

(async () => {
  const pathToExtension = require('path').join(__dirname, 'CapSolver.Browser.Extension');
  puppeteer.use(StealthPlugin())
  const browser = await puppeteer.launch({
    headless: false,
    args: [
      `--disable-extensions-except=${pathToExtension}`,
      `--load-extension=${pathToExtension}`,
    ],
    executablePath: executablePath()
  });
  
  const [page] = await browser.pages()
})();

Next, open the page https://www.google.com/recaptcha/api2/demo and send the CAPTCHA to CapSolver.

Using page.goto(), navigate to the target page. The CAPTCHA can be sent for solving either automatically or manually.
In this example, we trigger it manually by waiting for the CAPTCHA checkbox and clicking it.

js Copy
await page.goto('https://site.example') 

// Waiting for the element with the CSS selector "#recaptcha-anchor-label"
await page.waitForSelector('#recaptcha-anchor-label')
// Click on the element
await page.click('#recaptcha-anchor-label')

Full Code

js Copy
const puppeteer = require('puppeteer-extra');
const StealthPlugin = require('puppeteer-extra-plugin-stealth');
const { executablePath } = require('puppeteer'); 

(async () => {
  const pathToExtension = require('path').join(__dirname, 'CapSolver.Browser.Extension');
  puppeteer.use(StealthPlugin())
  const browser = await puppeteer.launch({
    headless: false,
    args: [
      `--disable-extensions-except=${pathToExtension}`,
      `--load-extension=${pathToExtension}`,
    ],
    executablePath: executablePath()
  });
  
  const [page] = await browser.pages()

  // Opening a page
  await page.goto('https://site.example') 

  // Waiting for the element with the CSS selector "#recaptcha-anchor-label"
  await page.waitForSelector('#recaptcha-anchor-label')
  // Click on the element
  await page.click('#recaptcha-anchor-label')
})();

Conclusion

You have successfully solved reCAPTCHA v2 using Puppeteer and the CapSolver browser extension. This setup provides a flexible and scalable way to handle CAPTCHA challenges directly within a real browser environment. By adjusting the extension configuration, the same workflow can be reused for other CAPTCHA types supported by CapSolver, making it suitable for testing, automation, and large-scale browser-based tasks.

Frequently Asked Questions (FAQs)

1. Can this method be used in headless mode?
The CapSolver browser extension requires a visible browser environment. For this reason, headless: false is recommended when using the extension-based approach.

2. Does this setup work for CAPTCHA types other than reCAPTCHA v2?
Yes. The CapSolver extension supports multiple CAPTCHA types. You can enable or disable specific CAPTCHA solvers in the config.json file and adapt the workflow accordingly.

3. Is a proxy required when using the CapSolver extension?
A proxy is optional. The extension supports proxy configuration, but many use cases work without one. Proxy usage depends on your target website and automation requirements.

4. What is the difference between token and click modes for reCAPTCHA?
Token mode retrieves the CAPTCHA solution programmatically and is generally more stable for automation. Click mode simulates user interaction with the CAPTCHA checkbox.

5. Can this setup be used in production environments?
Yes. With proper configuration, error handling, and scaling considerations, this approach can be integrated into production-grade browser automation workflows.

More

reCAPTCHAApr 16, 2026

reCAPTCHA Score Explained: Range, Meaning, and How to Improve It

Understand reCAPTCHA v3 score range (0.0 to 1.0), its meaning, and how to improve your score. Learn how to handle low scores and optimize user experience.

Rajinder Singh
Rajinder Singh
reCAPTCHAApr 16, 2026

reCAPTCHA Invalid Site Key or Token? Causes & Fix Guide

Facing "reCAPTCHA Invalid Site Key" or "invalid reCAPTCHA token" errors? Discover common causes, step-by-step fixes, and troubleshooting tips to resolve reCAPTCHA verification failed issues. Learn how to fix reCAPTCHA verification failed please try again.

Contents

Aloísio Vítor
Aloísio Vítor
reCAPTCHAApr 15, 2026

reCAPTCHA Verification Failed? How to Fix "Please Try Again" Errors

Fix reCAPTCHA verification failed errors fast. Step-by-step manual fixes for users and a Python API guide for developers using CapSolver. Covers v2, v3, and Enterprise.

Adélia Cruz
Adélia Cruz
reCAPTCHAApr 15, 2026

reCAPTCHA v2 vs v3: Key Differences Every Developer Should Know

Understand the difference between reCAPTCHA v2 and v3 — how each works, when to use them, and how automated workflows handle both. A clear, technical comparison for developers.

Nikolai Smirnov
Nikolai Smirnov