CAPSOLVER
Blog
Solve Unlimited Captchas with best captcha solver

Solve Unlimited Captchas with best captcha solver

Logo of CapSolver

Ethan Collins

Pattern Recognition Specialist

16-Jul-2024

Solve Unlimited Captchas with the Best Captcha Solver

CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) is a security measure designed to distinguish human users from automated bots. It often presents challenges such as image recognition, text distortion, or interactive puzzles that are easy for humans but difficult for bots. While CAPTCHAs protect websites from automated abuse, they can be a significant hurdle for legitimate automation and web scraping activities.

In this blog, we'll explore how to solve CAPTCHAs using Playwright with the Capsolver extension. Additionally, we'll look at solving reCAPTCHA using the Capsolver API with Python and Go.

What is CAPTCHA?

CAPTCHA is a security mechanism used by websites to prevent automated access and ensure that the user is a human. Common types include:

  • Image Recognition: Users are asked to select images matching a specific description.
  • Text Distortion: Users type distorted text displayed on the screen.
  • Interactive Challenges: Users complete tasks such as dragging sliders or solving puzzles.

Capsolver: Your Solution to CAPTCHA Challenges

Capsolver is a powerful tool designed to automatically solve various types of CAPTCHAs, including captcha and reCAPTCHA. It provides browser extensions and APIs for seamless integration into your web automation workflows.

Installing Playwright and Required Components

First, you need to install Playwright. You can do this via npm:

bash Copy
npm install playwright

Configuring the Capsolver Extension

  1. Download the Capsolver extension from here.
  2. Unzip it into the ./CapSolver.Browser.Extension directory at the root of your project.
  3. Adjust the configuration settings in ./assets/config.json. Ensure enabledForcaptcha is set to true and set captchaMode to token for automatic solving.

Example configuration change:

json Copy
{
  "enabledForcaptcha": true,
  "captchaMode": "token"
}

Setting Up Playwright to Solve captcha with Capsolver Extension

Below is an example script using Playwright to solve captcha with the Capsolver extension:

javascript Copy
const { chromium } = require('playwright');
const path = require('path');

(async () => {
  const extensionPath = path.join(__dirname, 'CapSolver.Browser.Extension');

  const browser = await chromium.launchPersistentContext('', {
    headless: false,
    args: [
      `--disable-extensions-except=${extensionPath}`,
      `--load-extension=${extensionPath}`
    ]
  });

  const page = await browser.newPage();
  await page.goto('https://site.example');

  // Locate the captcha checkbox or frame and interact accordingly
  await page.waitForSelector('selector-for-captcha', { state: 'visible' });
  await page.click('selector-for-captcha');

  // Add additional steps as per your requirement
  // ...

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

Solving reCAPTCHA with Capsolver API

For reCAPTCHA, you can use the Capsolver API. Here are examples in Python and Go.

Python Example

python Copy
import requests
import time

api_key = "YOUR_API_KEY"
site_key = "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-"
site_url = "https://www.google.com/recaptcha/api2/demo"

def capsolver():
    payload = {
        "clientKey": api_key,
        "task": {
            "type": 'ReCaptchaV2TaskProxyLess',
            "websiteKey": site_key,
            "websiteURL": site_url
        }
    }
    res = requests.post("https://api.capsolver.com/createTask", json=payload)
    resp = res.json()
    task_id = resp.get("taskId")
    if not task_id:
        print("Failed to create task:", res.text)
        return
    print(f"Got taskId: {task_id} / Getting result...")

    while True:
        time.sleep(3)
        payload = {"clientKey": api_key, "taskId": task_id}
        res = requests.post("https://api.capsolver.com/getTaskResult", json=payload)
        resp = res.json()
        status = resp.get("status")
        if status == "ready":
            return resp.get("solution", {}).get('gRecaptchaResponse')
        if status == "failed" or resp.get("errorId"):
            print("Solve failed! response:", res.text)
            return

token = capsolver()
print(token)

Go Example

go Copy
package main

import (
	"bytes"
	"context"
	"encoding/json"
	"errors"
	"fmt"
	"io"
	"net/http"
	"time"
)

type capSolverResponse struct {
	ErrorId          int32          `json:"errorId"`
	ErrorCode        string         `json:"errorCode"`
	ErrorDescription string         `json:"errorDescription"`
	TaskId           string         `json:"taskId"`
	Status           string         `json:"status"`
	Solution         map[string]any `json:"solution"`
}

func capSolver(ctx context.Context, apiKey string, taskData map[string]any) (*capSolverResponse, error) {
	uri := "https://api.capsolver.com/createTask"
	res, err := request(ctx, uri, map[string]any{
		"clientKey": apiKey,
		"task":      taskData,
	})
	if err != nil {
		return nil, err
	}
	if res.ErrorId == 1 {
		return nil, errors.New(res.ErrorDescription)
	}

	uri = "https://api.capsolver.com/getTaskResult"
	for {
		select {
		case <-ctx.Done():
			return res, errors.New("solve timeout")
		case <-time.After(time.Second):
			break
		}
		res, err = request(ctx, uri, map[string]any{
			"clientKey": apiKey,
			"taskId":    res.TaskId,
		})
		if err != nil {
			return nil, err
		}
		if res.ErrorId == 1 {
			return nil, errors.New(res.ErrorDescription)
		}
		if res.Status == "ready" {
			return res, err
		}
	}
}

func request(ctx context.Context, uri string, payload interface{}) (*capSolverResponse, error) {
	payloadBytes, err := json.Marshal(payload)
	if err != nil {
		return nil, err
	}
	req, err := http.NewRequestWithContext(ctx, "POST", uri, bytes.NewReader(payloadBytes))
	if err != nil {
		return nil, err
	}
	req.Header.Set("Content-Type", "application/json")
	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	responseData, err := io.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}
	capResponse := &capSolverResponse{}
	err = json.Unmarshal(responseData, capResponse)
	if err != nil {
		return nil, err
	}
	return capResponse, nil
}

func main() {
	apikey := "YOUR_API_KEY"
	ctx, cancel := context.WithTimeout(context.Background(), time.Second*120)
	defer cancel()

	res, err := capSolver(ctx, apikey, map[string]any{
		"type":       "ReCaptchaV2TaskProxyLess",
		"websiteURL": "https://www.google.com/recaptcha/api2/demo",
		"websiteKey": "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",
	})
	if err != nil {
		panic(err)
	}
	fmt.Println(res.Solution["gRecaptchaResponse"])
}

Conclusion

Using tools like Playwright and Capsolver, you can automate the solving of CAPTCHAs, making web scraping and automation tasks more efficient. Whether you're dealing with captcha or reCAPTCHA, the methods outlined here provide a robust solution to overcome these challenges.

Happy scraping!

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

How to Identify and Obtain reCAPTCHA “s” Parameter Data
How to Identify and Obtain reCAPTCHA “s” Parameter Data

Learn to identify and obtain reCaptcha 's' data for effective captcha solving. Follow our step-by-step guide on using Capsolver's tools and techniques.

reCAPTCHA
Logo of CapSolver

Ethan Collins

25-Nov-2025

How to identify the extra parameters required for solve Google ReCaptcha
How to Identify and Submit reCAPTCHA Extra Parameters (v2/v3/Enterprise) | CapSolver Guide

Learn how to detect and submit extra reCAPTCHA parameters using CapSolver to improve accuracy and solve complex challenges.

reCAPTCHA
Logo of CapSolver

Rajinder Singh

10-Nov-2025

 How to Solve reCAPTCHA When Scraping Search Results with Puppeteer
How to Solve reCAPTCHA When Scraping Search Results with Puppeteer

Master the art of Puppeteer web scraping by learning how to reliably solve reCAPTCHA v2 and v3. Discover the best puppeteer recaptcha solver techniques for large-scale data harvesting and SEO automation.

reCAPTCHA
Logo of CapSolver

Lucas Mitchell

04-Nov-2025

AI Powered SEO Automation: How to Solve Captcha for Smarter SERP Data Collection
AI Powered SEO Automation: How to Solve Captcha for Smarter SERP Data Collection

Discover how AI Powered SEO Automation overcomes CAPTCHA challenges for smarter SERP data collection and learn about reCAPTCHA v2/v3 solutions

reCAPTCHA
Logo of CapSolver

Emma Foster

23-Oct-2025

Recaptcha Solver
reCAPTCHA Solver Auto Recognition and Solve Methods

Learn how to automatically recognize and solve Google reCAPTCHA v2, v3, invisible, and enterprise challenges using advanced AI and OCR techniques

reCAPTCHA
Logo of CapSolver

Sora Fujimoto

22-Oct-2025

Solve reCAPTCHA v2 Guide
How to Solve reCAPTCHA v2: Solve reCAPTCHA v2 Guide

Learn how to automate solving Google reCAPTCHA v2 using CapSolver. Discover API and SDK integration, step-by-step guides, and bonus codes to streamline captcha solving for web scraping, automation, and development projects.

reCAPTCHA
Logo of CapSolver

Aloísio Vítor

21-Oct-2025