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/All/How to Solve CAPTCHA in BrowserCloud with CapSolver API
Aug11, 2025

How to Solve CAPTCHA in BrowserCloud with CapSolver API

Ethan Collins

Ethan Collins

Pattern Recognition Specialist

BrowserCloud is a high-performance, cloud-based browser automation platform designed for scalable and distributed web automation. It enables developers to run hundreds of headless Chrome browsers in parallel for use cases such as web scraping, automated testing, SEO monitoring, data extraction, and content generation. With built-in support for Puppeteer, Selenium, and Playwright, BrowserCloud simplifies complex automation workflows by offering proxy rotation, session management, and real-time monitoring.

However, CAPTCHAs, bot detection systems, and advanced anti-automation measures often disrupt these browser automation tasks by demanding human-like interactions to verify authenticity. Such barriers can block scraping scripts, slow down testing pipelines, and break automated form submissions, resulting in wasted time and reduced efficiency.

CapSolver, an AI-powered CAPTCHA-solving and bot detection bypass service, provides a reliable solution. It programmatically detects and solves a wide range of CAPTCHA types—including reCAPTCHA v2/v3, Cloudflare Turnstile, and image-based puzzles—ensuring uninterrupted browser automation workflows.

In this article, we’ll provide a step-by-step integration guide for connecting CapSolver with BrowserCloud using Puppeteer, along with a fully working code example. By following this guide, you’ll be able to seamlessly bypass CAPTCHA challenges, defeat anti-bot measures, and maximize the efficiency of your automation scripts.

BrowserCloud Overview & Use Cases

BrowserCloud is a versatile platform that manages a grid of full-featured Chrome browsers on high-performance infrastructure, eliminating the need to handle local browser dependencies, memory leaks, or infrastructure maintenance. Its key features include:

  • Scalability: Run up to 100 headless browsers simultaneously for parallel processing.
  • Framework Support: Compatible with Puppeteer, Selenium, and Playwright for flexible automation.
  • Proxy Management: Offers smart proxy rotation and premium proxies to avoid detection and IP bans.
  • Content Generation: Generate PDFs, screenshots, and images from web pages or custom HTML via API.
  • Real-Time Monitoring: Provides tools for session management and debugging.

Use Cases

BrowserCloud supports a range of automation tasks, including:

  • Web Scraping: Extract data from websites for market research, price monitoring, or content aggregation, leveraging proxy support to avoid blocks.
  • Automated Testing: Conduct end-to-end testing across multiple browsers and configurations to ensure application reliability.
  • Content Rendering: Create thousands of PDF reports, invoices, or automated screenshots from URLs for reporting or marketing purposes.
  • Task Automation: Automate repetitive tasks like form submissions, account logins, or link validation.

These use cases often encounter CAPTCHAs, making CapSolver’s integration essential for uninterrupted automation.

Why CAPTCHA Solving is Needed

Websites deploy CAPTCHAs and anti-bot defenses to protect against automated access, spam, and malicious activities, posing a significant challenge for automation tasks like web scraping. CAPTCHAs require interactions such as clicking checkboxes or solving image puzzles, which can halt BrowserCloud scripts if not addressed. Common CAPTCHA types include:

CAPTCHA Type Description
reCAPTCHA v2 Requires users to check a box or select images based on a prompt.
reCAPTCHA v3 Uses a scoring system to assess user behavior, often invisible to users.
Cloudflare Turnstile A privacy-focused CAPTCHA alternative that minimizes user interaction.

For web scraping and other automation tasks, CAPTCHAs can prevent access to critical data, requiring manual intervention that defeats the purpose of automation. While BrowserCloud’s proxy rotation helps reduce CAPTCHA triggers, it may not eliminate them entirely. CapSolver’s API provides a reliable solution by solving CAPTCHAs programmatically, allowing BrowserCloud scripts to bypass these barriers and continue extracting data or performing tasks seamlessly.

How to Use CapSolver to Handle CAPTCHAs

CapSolver’s API can be integrated with BrowserCloud within a Puppeteer/Playwright/Selenium script to handle CAPTCHAs effectively. The process involves:

  1. Detecting the CAPTCHA: Identify the presence of a CAPTCHA on the page, such as a reCAPTCHA element.
  2. Extracting Information: Retrieve necessary details, like the site key and page URL, required for CAPTCHA solving.
  3. Calling CapSolver’s API: Send a request to CapSolver to create a task and obtain a solution token.
  4. Injecting the Solution: Insert the token into the page to bypass the CAPTCHA.
  5. Continuing Automation: Proceed with tasks like form submission or data scraping.

This integration leverages BrowserCloud’s scalable browser infrastructure and CapSolver’s AI-driven CAPTCHA-solving capabilities to ensure robust automation workflows.

Complete Code Example + Step-by-Step Explanation

Below is a complete code example that demonstrates how to integrate CapSolver with BrowserCloud to solve a reCAPTCHA v2 on a demo page. The code is based on the provided script, with minor improvements for clarity and reliability.

Prerequisites

Install the required dependencies:

bash Copy
npm install puppeteer node-fetch@2 dotenv

Create a .env file with your API keys:

env Copy
BROWSER_CLOUD_TOKEN=your_browsercloud_token
CAPSOLVER_API_KEY=your_capsolver_api_key

Code Example

javascript Copy
import puppeteer from 'puppeteer';
import fetch from 'node-fetch';
import dotenv from 'dotenv';
dotenv.config();

const BROWSER_CLOUD_TOKEN = process.env.BROWSER_CLOUD_TOKEN;
const CAPSOLVER_API_KEY = process.env.CAPSOLVER_API_KEY;

async function solveCaptcha(sitekey, pageUrl) {
    const createTaskRes = await fetch('https://api.capsolver.com/createTask', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({
            clientKey: CAPSOLVER_API_KEY,
            task: {
                type: 'ReCaptchaV2TaskProxyless',
                websiteURL: pageUrl,
                websiteKey: sitekey
            }
        })
    });
    const createTask = await createTaskRes.json();
    if (!createTask.taskId) throw new Error(`CapSolver: Failed to create task: ${JSON.stringify(createTask)}`);

    let solution = null;
    while (true) {
        await new Promise(resolve => setTimeout(resolve, 2000));
        const resultRes = await fetch('https://api.capsolver.com/getTaskResult', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json' },
            body: JSON.stringify({
                clientKey: CAPSOLVER_API_KEY,
                taskId: createTask.taskId
            })
        });
        const result = await resultRes.json();
        if (result.status === 'ready') {
            solution = result.solution.gRecaptchaResponse;
            break;
        }
        if (result.status === 'failed') throw new Error(`CapSolver: Failed to solve: ${JSON.stringify(result)}`);
    }
    if (!solution) throw new Error('CapSolver: Timeout waiting for solution');
    return solution;
}

(async () => {
    try {
        const browser = await puppeteer.connect({
            browserWSEndpoint: `wss://chrome-v2.browsercloud.io?token=${BROWSER_CLOUD_TOKEN}`
        });

        const page = await browser.newPage();
        await page.goto('https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php', { waitUntil: 'networkidle2' });

        const sitekey = await page.$eval('.g-recaptcha', el => el.getAttribute('data-sitekey'));
        console.log('Sitekey:', sitekey);

        const solution = await solveCaptcha(sitekey, page.url());
        console.log('CAPTCHA solution:', solution);

        await page.evaluate(token => {
            const textarea = document.getElementById('g-recaptcha-response');
            if (textarea) {
                textarea.value = token;
                textarea.innerHTML = token;
                textarea.style.display = '';
                textarea.dispatchEvent(new Event('input', { bubbles: true }));
            }
        }, solution);

        const submitBtn = await page.$('body > main > form > fieldset > button');
        if (submitBtn) {
            await Promise.all([
                page.waitForNavigation({ waitUntil: 'networkidle2' }),
                submitBtn.click()
            ]);
            console.log('Submit button clicked!');
        } else {
            console.log('Submit button not found!');
        }

        console.log('Page content after submission:', await page.content());

        await browser.close();
    } catch (error) {
        console.error('Error:', error);
    }
})();

Step-by-Step Explanation

Step Description
1. Set Up Environment Install puppeteer, node-fetch@2, and dotenv using npm. Create a .env file with your BrowserCloud and CapSolver API keys.
2. Define solveCaptcha Function The function takes the site key and page URL, creates a CapSolver task for reCAPTCHA v2, polls for the solution (up to 30 attempts with 2-second intervals), and returns the solution token.
3. Connect to BrowserCloud Use puppeteer.connect with the BrowserCloud WebSocket endpoint, including your API token. Note that createIncognitoBrowserContext is not supported in BrowserCloud’s remote mode, so use browser.newPage() directly.
4. Navigate to Target Page Open a new page and navigate to the demo page with reCAPTCHA v2, waiting for the network to be idle.
5. Extract Site Key Use page.$eval to retrieve the data-sitekey attribute from the .g-recaptcha element.
6. Solve CAPTCHA Call solveCaptcha with the site key and page URL to obtain the solution token from CapSolver.
7. Inject Solution Inject the solution token into the g-recaptcha-response textarea and dispatch an input event to simulate user interaction.
8. Submit Form Locate the submit button, click it, and wait for navigation to ensure the form submission is processed.
9. Verify Result Print the page content to confirm successful submission.
10. Close Browser Close the browser connection to free resources.

Note: The original code used page.waitForTimeout(3000) after clicking the submit button, which may not reliably wait for navigation. This example improves it by using page.waitForNavigation() to ensure the page has fully loaded after submission.

Demo Walkthrough

This section describes the script’s execution on a demo page with a reCAPTCHA v2 checkbox:

  1. Connect to BrowserCloud: The script establishes a connection to a BrowserCloud browser instance using Puppeteer.
  2. Navigate to Demo Page: It loads the reCAPTCHA v2 demo page (https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php).
  3. Detect and Extract Site Key: The script identifies the reCAPTCHA element and extracts its site key.
  4. Solve CAPTCHA: It sends the site key and page URL to CapSolver, receiving a solution token after polling.
  5. Inject Token: The token is injected into the g-recaptcha-response textarea, simulating a successful CAPTCHA verification.
  6. Submit Form: The script clicks the submit button, triggering form submission.
  7. Verify Success: After navigation, the page content is logged, showing a successful submission (e.g., a confirmation message).

In practice, you would observe the browser navigating to the demo page, the reCAPTCHA checkbox being marked automatically, and the form submitting successfully, all without manual intervention.

FAQ Section

Question Answer
What types of CAPTCHAs does CapSolver support? CapSolver supports reCAPTCHA v2/v3, Cloudflare Turnstile and more. See CapSolver documentation for details.
How do I get API keys for BrowserCloud and CapSolver? Sign up at BrowserCloud and CapSolver to obtain your API keys after registration.
Can I use this integration with Selenium or Playwright? Yes, you can adapt the integration for Selenium or Playwright by modifying the browser control and page manipulation logic to match those frameworks’ APIs.
What if CapSolver fails to solve the CAPTCHA? Implement retry logic in your script or check your CapSolver account for issues like insufficient balance. Log errors for debugging.
Do I need proxies with CapSolver? The example uses ReCaptchaV2TaskProxyless, but proxies may be needed for region-specific CAPTCHAs. BrowserCloud’s built-in proxy rotation can complement this.

Conclusion

Integrating CapSolver with BrowserCloud creates a powerful combination for automating web tasks that encounter CAPTCHAs. CapSolver’s AI-driven CAPTCHA solving ensures that your Puppeteer scripts on BrowserCloud can bypass anti-bot measures, while BrowserCloud’s scalable infrastructure and proxy support enhance automation reliability. This is particularly valuable for web scraping, automated testing, and content generation, where CAPTCHAs are common obstacles.

To get started, sign up for BrowserCloud and CapSolver, obtain your API keys, and implement the provided code example. Explore the CapSolver documentation and BrowserCloud documentation for advanced features and additional task types. Try this integration in your next automation project and experience seamless, uninterrupted workflows!

Bonus for Browser-use Users: Use the promo code BROWSERCLOUD when recharging your CapSolver account and receive an exclusive 6% bonus credit—no limits, no expiration.

image

Supported Browsers and Tools

  • BrowserCloud: Supports Puppeteer, Selenium, and Playwright, running Chrome browsers.
  • CapSolver: Compatible with any HTTP-capable client, including browser extensions for Chrome and Firefox.

References

  • BrowserCloud Official Website
  • CapSolver Official Website
  • Puppeteer Documentation
  • CapSolver API Documentation

More

About CapsolverApr 20, 2026

The Evolution of Automation Infrastructure: How CapSolver's Strategic Upgrade Empowers Data-Driven Businesses

CapSolver evolves into a core automation layer with improved UI, integrations, and enterprise-grade data capabilities.

Lucas Mitchell
Lucas Mitchell
AIApr 22, 2026

Best AI for Solving Image Puzzles: Top Tools and Strategies for 2026

Discover the best AI for solving image puzzles. Learn how CapSolver's Vision Engine and ImageToText APIs automate complex visual challenges with high accuracy.

Contents

Ethan Collins
Ethan Collins
Web ScrapingApr 22, 2026

Rust Web Scraping Architecture for Scalable Data Extraction

Learn scalable Rust web scraping architecture with reqwest, scraper, async scraping, headless browser scraping, proxy rotation, and compliant CAPTCHA handling.

Lucas Mitchell
Lucas Mitchell
AIApr 22, 2026

Search API vs Knowledge Supply Chain: AI Data Infrastructure Guide

Learn how search API tools, knowledge supply chains, SERP API workflows, and AI data pipelines shape modern web data infrastructure for AI.

Anh Tuan
Anh Tuan