hCaptcha Solving
Overview
Surfsky provides automated hCaptcha solving capabilities through our unified CAPTCHA solving system. We handle hCaptcha challenges automatically, letting your automation continue without interruption.
Quick Start
For most use cases, our simplified CAPTCHA solving approach is all you need. See our comprehensive CAPTCHA Solving Guide for full details.
Prerequisites
- Enable
anti_captcha
in your browser profile settings - Gemini API Key - Get one from Google AI Studio
- Pass it when starting your browser. See API Reference for details
- Use quality proxies to minimize CAPTCHA encounters
Solving Methods
Method 1: Simple Manual Solving (Recommended)
The easiest way to handle hCaptcha - let us detect and solve it for you:
- Python
- JavaScript
import asyncio
from playwright.async_api import async_playwright
async def solve_hcaptcha_simple():
async with async_playwright() as p:
# Connect to your Surfsky browser
browser = await p.chromium.connect_over_cdp("ws://your-browser-url")
page = await browser.new_page()
# Create CDP session
client = await page.context.new_cdp_session(page)
# Navigate to page with hCaptcha
await page.goto("https://example.com/hcaptcha-protected")
# Check if hCaptcha is present
if await page.query_selector(".h-captcha"):
print("hCaptcha detected, solving...")
# Solve hCaptcha
response = await client.send("Captcha.solve", {"type": "hcaptcha"})
if response.get("status") == "success":
print("✓ hCaptcha solved!")
# Continue with your automation
await page.click("#submit")
else:
print("✗ Failed to solve hCaptcha")
await browser.close()
asyncio.run(solve_hcaptcha_simple())
const { chromium } = require('playwright');
async function solveHcaptchaSimple() {
// Connect to your Surfsky browser
const browser = await chromium.connectOverCDP('ws://your-browser-url');
const page = await browser.newPage();
// Create CDP session
const client = await page.context().newCDPSession(page);
// Navigate to page with hCaptcha
await page.goto('https://example.com/hcaptcha-protected');
// Check if hCaptcha is present
const hcaptchaElement = await page.$('.h-captcha');
if (hcaptchaElement) {
console.log('hCaptcha detected, solving...');
// Solve hCaptcha
const response = await client.send('Captcha.solve', { type: 'hcaptcha' });
if (response.status === 'success') {
console.log('✓ hCaptcha solved!');
// Continue with your automation
await page.click('#submit');
} else {
console.log('✗ Failed to solve hCaptcha');
}
}
await browser.close();
}
solveHcaptchaSimple().catch(console.error);
Method 2: Auto Solving
Let the browser automatically detect and solve hCaptcha challenges:
- Python
- JavaScript
import asyncio
from playwright.async_api import async_playwright
async def solve_hcaptcha_auto():
async with async_playwright() as p:
browser = await p.chromium.connect_over_cdp("ws://your-browser-url")
page = await browser.new_page()
client = await page.context.new_cdp_session(page)
# Enable auto-solving for hCaptcha
await client.send("Captcha.autoSolve", {"type": "hcaptcha"})
print("Auto-solve activated - hCaptcha will be solved automatically")
# Navigate to any page - hCaptcha challenges will be handled automatically
await page.goto("https://example.com/hcaptcha-protected")
# Continue with your automation
# Any hCaptcha that appears will be solved in the background
await browser.close()
asyncio.run(solve_hcaptcha_auto())
const { chromium } = require('playwright');
async function solveHcaptchaAuto() {
const browser = await chromium.connectOverCDP('ws://your-browser-url');
const page = await browser.newPage();
const client = await page.context().newCDPSession(page);
// Enable auto-solving for hCaptcha
await client.send('Captcha.autoSolve', { type: 'hcaptcha' });
console.log('Auto-solve activated - hCaptcha will be solved automatically');
// Navigate to any page - hCaptcha challenges will be handled automatically
await page.goto('https://example.com/hcaptcha-protected');
// Continue with your automation
// Any hCaptcha that appears will be solved in the background
await browser.close();
}
solveHcaptchaAuto().catch(console.error);
Best Practices
- Use Auto Mode for seamless automation - set it once and forget
- Reuse Profiles that have successfully passed hCaptcha for better success rates
- Quality Proxies reduce hCaptcha frequency significantly
- Human Emulation helps avoid triggering hCaptcha in the first place
Need Help?
For more details on CAPTCHA solving, including event handling and troubleshooting, see our comprehensive CAPTCHA Solving Guide.
Questions? Contact us at [email protected].