Skip to main content

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

  1. Enable anti_captcha in your browser profile settings
  2. Gemini API Key - Get one from Google AI Studio
    • Pass it when starting your browser. See API Reference for details
  3. Use quality proxies to minimize CAPTCHA encounters

Solving Methods

The easiest way to handle hCaptcha - let us detect and solve it for you:

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())

Method 2: Auto Solving

Let the browser automatically detect and solve hCaptcha challenges:

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())

Best Practices

  1. Use Auto Mode for seamless automation - set it once and forget
  2. Reuse Profiles that have successfully passed hCaptcha for better success rates
  3. Quality Proxies reduce hCaptcha frequency significantly
  4. 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].