Not all CAPTCHAs are reCAPTCHA or standard text images. Custom CAPTCHAs require creative approaches for parameter extraction and submission.
Identifying Custom CAPTCHAs
| Type | Characteristics | Approach |
|---|---|---|
| Slider CAPTCHA | Drag to position | Screenshot as image, use text instructions |
| Puzzle (jigsaw) | Drag piece to fit | May map to GeeTest-style solving |
| Audio CAPTCHA | Listen and type | Submit audio file |
| Rotate image | Rotate to correct orientation | Screenshot + instructions |
| Select order | Click items in sequence | Use image grid approach |
| Math equation | Solve arithmetic | Use calc=1 parameter |
| Custom interactive | Site-specific JS widget | Screenshot + text instructions |
Submitting Custom Images with Instructions
For any visual CAPTCHA, screenshot it and provide instructions:
import requests
import base64
import time
import os
API_KEY = os.environ["CAPTCHAAI_API_KEY"]
def solve_custom_captcha(image_b64, instructions):
"""Solve any visual CAPTCHA using image + text instructions."""
resp = requests.post("https://ocr.captchaai.com/in.php", data={
"key": API_KEY,
"method": "base64",
"body": image_b64,
"textinstructions": instructions,
"json": 1,
}, timeout=30)
result = resp.json()
if result.get("status") != 1:
raise RuntimeError(result.get("request"))
task_id = result["request"]
time.sleep(10)
for _ in range(30):
resp = requests.get("https://ocr.captchaai.com/res.php", params={
"key": API_KEY, "action": "get",
"id": task_id, "json": 1,
}, timeout=15)
data = resp.json()
if data.get("status") == 1:
return data["request"]
if data["request"] != "CAPCHA_NOT_READY":
raise RuntimeError(data["request"])
time.sleep(5)
raise TimeoutError("Solve timeout")
Slider Position CAPTCHAs
CAPTCHAs that require dragging a slider to a specific position:
# slider_captcha.py
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
def solve_slider_captcha(driver, captcha_selector):
"""Screenshot slider CAPTCHA and solve via CaptchaAI."""
captcha = driver.find_element(By.CSS_SELECTOR, captcha_selector)
image_b64 = captcha.screenshot_as_base64
result = solve_custom_captcha(
image_b64,
"What pixel position should the slider be dragged to? "
"Return only the X offset number."
)
try:
offset = int(result)
except ValueError:
return False
# Drag slider to position
slider = driver.find_element(By.CSS_SELECTOR, ".slider-handle")
ActionChains(driver).click_and_hold(slider).move_by_offset(offset, 0).release().perform()
return True
Rotation CAPTCHAs
CAPTCHAs where an image must be rotated to the correct orientation:
# rotation_captcha.py
def solve_rotation_captcha(driver, captcha_selector):
"""Solve rotation CAPTCHA."""
captcha = driver.find_element(By.CSS_SELECTOR, captcha_selector)
image_b64 = captcha.screenshot_as_base64
result = solve_custom_captcha(
image_b64,
"How many degrees should this image be rotated clockwise "
"to be in the correct upright orientation? Return only the number."
)
try:
degrees = int(result)
except ValueError:
return False
# Click rotation button the correct number of times
rotate_btn = driver.find_element(By.CSS_SELECTOR, ".rotate-button")
clicks = degrees // 90 # Each click rotates 90 degrees
for _ in range(clicks):
rotate_btn.click()
time.sleep(0.3)
return True
Selection Order CAPTCHAs
CAPTCHAs where items must be clicked in a specific order:
# order_captcha.py
def solve_order_captcha(driver, captcha_selector, item_selector):
"""Solve click-in-order CAPTCHA."""
captcha = driver.find_element(By.CSS_SELECTOR, captcha_selector)
image_b64 = captcha.screenshot_as_base64
result = solve_custom_captcha(
image_b64,
"What is the correct order? Return as comma-separated "
"numbers (1-indexed) representing positions left-to-right, top-to-bottom."
)
# Parse order
try:
order = [int(x.strip()) for x in result.split(",")]
except ValueError:
return False
# Click items in order
items = driver.find_elements(By.CSS_SELECTOR, item_selector)
for idx in order:
if 1 <= idx <= len(items):
items[idx - 1].click()
time.sleep(0.5)
return True
Audio CAPTCHAs
Some sites offer audio alternatives:
# audio_captcha.py
import requests
def solve_audio_captcha(audio_url):
"""Download and solve an audio CAPTCHA."""
# Download audio
resp = requests.get(audio_url, timeout=30)
audio_b64 = base64.b64encode(resp.content).decode("ascii")
# Submit as image with instructions
# CaptchaAI may support audio via the base64 method
result = solve_custom_captcha(
audio_b64,
"This is an audio CAPTCHA. Transcribe the spoken characters."
)
return result
Custom Widget CAPTCHAs
For completely custom CAPTCHA widgets:
# custom_widget.py
from selenium import webdriver
from selenium.webdriver.common.by import By
def handle_custom_widget(driver, widget_selector):
"""Handle an unknown custom CAPTCHA widget."""
# Step 1: Screenshot the entire widget
widget = driver.find_element(By.CSS_SELECTOR, widget_selector)
image_b64 = widget.screenshot_as_base64
# Step 2: Get any visible instructions
try:
instructions_el = widget.find_element(By.CSS_SELECTOR, ".instructions, .prompt, p")
visible_instructions = instructions_el.text
except Exception:
visible_instructions = "Solve this CAPTCHA"
# Step 3: Submit with descriptive instructions
result = solve_custom_captcha(
image_b64,
f"CAPTCHA instructions: {visible_instructions}. "
f"Return the answer text."
)
# Step 4: Try to submit result
try:
input_el = widget.find_element(By.CSS_SELECTOR, "input")
input_el.clear()
input_el.send_keys(result)
except Exception:
# No input — try clicking based on result
driver.execute_script("""
var input = document.querySelector('input[name*="captcha"]');
if (input) input.value = arguments[0];
""", result)
return result
CAPTCHA Type Detection
# detector.py
import re
def detect_captcha_type(page_html):
"""Detect which CAPTCHA type is on a page."""
checks = {
"recaptcha_v2": r'data-sitekey.*g-recaptcha',
"recaptcha_v3": r'recaptcha/api\.js\?render=',
"turnstile": r'cf-turnstile|challenges\.cloudflare\.com/turnstile',
"geetest": r'gt\b.*challenge|geetest',
"bls": r'method.*bls|bls-captcha',
"image_text": r'captcha.*\.(png|jpg|gif|jpeg)',
"slider": r'slider.*captcha|slide.*verify',
"audio": r'audio.*captcha|captcha.*audio',
}
detected = []
for captcha_type, pattern in checks.items():
if re.search(pattern, page_html, re.IGNORECASE):
detected.append(captcha_type)
return detected if detected else ["unknown"]
Troubleshooting
| Issue | Cause | Fix |
|---|---|---|
ERROR_CAPTCHA_UNSOLVABLE |
Image unclear or instructions vague | Improve screenshot quality and instructions |
| Wrong answer format | Solver returned description instead of value | Be specific: "Return only the number" |
| Custom widget not captured | Element outside viewport | Scroll to element before screenshot |
| Interaction fails | Wrong click coordinates | Map solution to actual UI elements carefully |
FAQ
Can CaptchaAI solve any CAPTCHA type?
CaptchaAI supports 27,500+ CAPTCHA types natively. For truly novel custom CAPTCHAs, the image + text instructions approach provides the best coverage.
What if the custom CAPTCHA changes frequently?
Use the type detection function to identify the current challenge and route to the appropriate solver.
How do I get support for a new CAPTCHA type?
Contact CaptchaAI support with example images and the site URL. New types can be added to the platform.
Related Guides
Solve any CAPTCHA — start with CaptchaAI.
Discussions (0)
Join the conversation
Sign in to share your opinion.
Sign InNo comments yet.