Bypass reCAPTCHA, hCaptcha & image captchas inside Selenium WebDriver — Last Updated: August 29, 2026
⚡ TL;DR: Selenium can't solve CAPTCHAs alone. The working recipe is: grab the sitekey from the page → send it to the CaptchaKings API → receive a valid token in ~3 seconds → inject it with driver.execute_script() → submit. Full working code below. Free $0.50 credit on signup — no card required.
reCAPTCHA, hCaptcha, and Cloudflare Turnstile are specifically designed to detect browser automation. Even with undetected-chromedriver or selenium-stealth, high-traffic sites will eventually challenge your bot. Fighting the detection is an arms race you will lose — the professional approach is to solve the challenge programmatically and continue your automation flow.
pip install selenium captchakings
# Optional but recommended for fewer detections:
pip install undetected-chromedriver
This complete, runnable example opens a page, extracts the sitekey, solves it with CaptchaKings, and injects the token:
import time
from selenium import webdriver
from captchakings import CaptchaKings
API_KEY = "ck_your_api_key_here" # from captchakings.com/dashboard
PAGE_URL = "https://example.com/signup" # page with the reCAPTCHA
client = CaptchaKings(API_KEY)
driver = webdriver.Chrome()
driver.get(PAGE_URL)
# 1. Extract the sitekey rendered on the page
sitekey = driver.execute_script("""
const el = document.querySelector('[data-sitekey]');
return el ? el.getAttribute('data-sitekey') : null;
""")
print("sitekey:", sitekey)
# 2. Ask CaptchaKings to solve it (returns a valid g-recaptcha-response token)
token = client.solve_recaptcha_v2(sitekey=sitekey, page_url=PAGE_URL)
print("token received in <3s")
# 3. Inject the token and submit
driver.execute_script("""
document.getElementById('g-recaptcha-response').innerHTML = arguments[0];
document.getElementById('g-recaptcha-response').style.display = 'block';
""", token)
driver.execute_script("document.querySelector('form').submit()")
time.sleep(3)
print("Done:", driver.current_url)
driver.quit()
For classic image captchas, screenshot the element and send it straight to the API:
img = driver.find_element("css selector", "#captcha-image")
img.screenshot("captcha.png")
result = client.solve("captcha.png")
print(result["prediction"], "| confidence:", result["confidence"])
| CAPTCHA Type | Avg. Solve Time | Price / 1,000 |
|---|---|---|
| reCAPTCHA v2 / v3 / Enterprise | < 3 s | $0.60 – $2.00 |
| hCaptcha / hCaptcha Enterprise | < 3 s | $0.60 – $2.00 |
| Cloudflare Turnstile | < 3 s | $0.60 – $2.00 |
| AWS WAF (Amazon) | < 4 s | $1.00 – $2.00 |
| Image / Text / Math / Number | < 2 s | $0.30 – $0.80 |
| GeeTest, FunCaptcha, DataDome + 50 more | < 4 s | see pricing |
Extract the sitekey, send it to CaptchaKings, inject the returned token into #g-recaptcha-response, then submit the form — exactly as shown in Step 2 above.
Yes. The solver runs server-side, so it works with any WebDriver flavor: headless Chrome, Firefox, undetected-chromedriver, and remote Selenium Grid / BrowserStack sessions.
Call client.report_bad(task_id) for an automatic refund of that solve, then request a fresh token. Rejected solves are rare (success rate is above 99% for reCAPTCHA v2) and always refunded.
🎁 Free $0.50 credit — enough for 600+ image captchas or ~250 reCAPTCHA solves. Create your API key →