How to solve reCaptcha v2 using Puppeteer [Javascript] with CapSolver Extension

Ethan Collins
Pattern Recognition Specialist
23-Jul-2023

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.
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
{
"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:
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
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
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
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.
Compliance Disclaimer: The information provided on this blog is for informational purposes only. CapSolver is committed to compliance with all applicable laws and regulations. The use of the CapSolver network for illegal, fraudulent, or abusive activities is strictly prohibited and will be investigated. Our captcha-solving solutions enhance user experience while ensuring 100% compliance in helping solve captcha difficulties during public data crawling. We encourage responsible use of our services. For more information, please visit our Terms of Service and Privacy Policy.
More

CapSolver Extension: Effortlessly Solve Image Captcha and ImageToText Challenges in Your Browser
Use the CapSolver Chrome Extension for AI-powered, one-click solving of Image Captcha and ImageToText challenges directly in your browser.

Lucas Mitchell
11-Dec-2025
![How to Solve AWS Captcha Using Puppeteer [Javascript] with CapSolver Extension](https://assets.capsolver.com/prod/posts/aws-captcha-solver-puppeteer/5e93a8e9739b4c24ab2f6cbba8563a93.png)
How to Solve AWS Captcha Using Puppeteer [Javascript] with CapSolver Extension
Learn to seamlessly solve AWS Captcha with Puppeteer and Capsolver Extension, a detailed guide on setting up and automating captcha solutions effectively

Ethan Collins
25-Nov-2025

Best Captcha Solver Extension, What Extension Service Solves Captcha Automatically?
Solve CAPTCHAs automatically with the CapSolver browser extension — the fastest, AI-powered CAPTCHA solver for Chrome

Sora Fujimoto
21-Oct-2025

Captcha Solver Extensions, How to Install Captcha Solver Extension
How to install and use the CapSolver browser extension — the best AI-powered CAPTCHA solver for Chrome and Firefox. Discover its benefits, automation integration, and easy setup guide for effortless CAPTCHA handling.

Lucas Mitchell
20-Oct-2025

How to Solve reCAPTCHAs Automatically | the Best reCAPTCHA Auto Solver
Discover the ultimate reCAPTCHA Auto Solver. Learn how CapSolver's AI-powered Chrome Extension automates reCAPTCHA v2, v3 solving with high accuracy and efficiency. Boost your productivity today.

Ethan Collins
20-Oct-2025

Auto Captcha Solver Chrome: CapSolver Auto Solver Extension Download
Looking for the best Chrome extension to automatically solve captchas? CapSolver Auto Solver Extension offers a fast, AI-powered way to bypass reCAPTCHA and other verification challenges.

Lucas Mitchell
18-Oct-2025

