Solve Unlimited Captchas with best captcha solver

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
npm install playwright
Configuring the Capsolver Extension
- Download the Capsolver extension from here.
- Unzip it into the
./CapSolver.Browser.Extension
directory at the root of your project. - Adjust the configuration settings in
./assets/config.json
. EnsureenabledForcaptcha
is set totrue
and setcaptchaMode
totoken
for automatic solving.
Example configuration change:
json
{
"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
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
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
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

Top 5 Captcha Solvers for reCAPTCHA Recognition in 2025
Explore 2025's top 5 CAPTCHA solvers, including AI-driven CapSolver for fast reCAPTCHA recognition. Compare speed, pricing, and accuracy here

Lucas Mitchell
23-Jan-2025

What is a reCAPTCHA Site Key and How to Find It?
Learn how to find a reCAPTCHA Site Key manually or with tools like Capsolver. Fix common issues and automate CAPTCHA solving for developers and web scraping.

Rajinder Singh
23-Jan-2025

What Is reCAPTCHA Recognition? A Beginner's Guide
Struggling with reCAPTCHA image grids? Discover how Capsolver's AI-powered recognition solves 'Select all ' challenges instantly. Learn API integration, browser extensions, and pro tips to automate CAPTCHA solving with 95%+ accuracy

Ethan Collins
23-Jan-2025

What is the best reCAPTCHA v2 and v3 Solver while web scraping in 2025
In 2025, with the heightened sophistication of anti-bot systems, finding reliable reCAPTCHA solvers has become critical for successful data extraction.

Lucas Mitchell
17-Jan-2025

Solving reCAPTCHA with AI Recognition in 2025
Explore how AI is transforming reCAPTCHA-solving, CapSolver's solutions, and the evolving landscape of CAPTCHA security in 2025.

Ethan Collins
11-Nov-2024

Solving reCAPTCHA Using Python, Java, and C++
What to know how to successfully solve reCAPTCHA using three powerful programming languages: Python, Java, and C++ in one blog? Get in!

Lucas Mitchell
25-Oct-2024