Troubleshooting

ERROR_WRONG_GOOGLEKEY: Complete Diagnosis and Fix Guide

ERROR_WRONG_GOOGLEKEY means the googlekey parameter is invalid or doesn't match the target page. This guide covers every cause and fix.


What Causes This Error

Cause How to Identify
Incorrect sitekey extracted Key doesn't match page source
Enterprise sitekey sent as standard Need enterprise=1 parameter
Invisible reCAPTCHA key mismatch Need invisible=1 parameter
Dynamic sitekey changed Key rotated since extraction
Wrong page's sitekey Extracted from iframe or different domain
Hardcoded outdated sitekey Key was valid previously

How to Find the Correct Sitekey

import re
import requests


def extract_sitekey(page_url):
    """Extract reCAPTCHA sitekey from page source."""
    resp = requests.get(page_url, timeout=15)
    html = resp.text

    # Pattern 1: data-sitekey attribute
    match = re.search(r'data-sitekey="([^"]+)"', html)
    if match:
        return match.group(1)

    # Pattern 2: grecaptcha.render call
    match = re.search(r"grecaptcha\.render\([^,]+,\s*\{[^}]*sitekey['\"]?\s*:\s*['\"]([^'\"]+)", html)
    if match:
        return match.group(1)

    # Pattern 3: grecaptcha.execute call
    match = re.search(r"grecaptcha\.execute\(['\"]([^'\"]+)", html)
    if match:
        return match.group(1)

    # Pattern 4: reCAPTCHA script src
    match = re.search(r"recaptcha/api\.js\?render=([^&\"]+)", html)
    if match:
        return match.group(1)

    return None


sitekey = extract_sitekey("https://example.com/login")
print(f"Sitekey: {sitekey}")

Method 2: Browser DevTools

  1. Open target page in Chrome
  2. Press F12Elements tab
  3. Press Ctrl+F and search for sitekey
  4. Find data-sitekey="..." attribute
  5. Copy the value (40-character alphanumeric string)

Method 3: Network Tab

  1. Open F12Network tab
  2. Filter by recaptcha
  3. Look for requests to google.com/recaptcha/api2/anchor
  4. Find the k= parameter in the URL — that's the sitekey

Validation Before Submitting

import re


def validate_sitekey(sitekey):
    """Validate sitekey format before API call."""
    if not sitekey:
        raise ValueError("Sitekey is empty")

    # Standard format: 40 alphanumeric + hyphens/underscores
    if not re.match(r'^[a-zA-Z0-9_-]{20,60}$', sitekey):
        raise ValueError(f"Invalid sitekey format: {sitekey}")

    return True


# Use before solving
sitekey = extract_sitekey("https://example.com/login")
validate_sitekey(sitekey)

Handling reCAPTCHA Enterprise

Enterprise sitekeys look the same but require the enterprise parameter:

import requests

# Standard reCAPTCHA — loads via recaptcha/api.js
# Enterprise reCAPTCHA — loads via recaptcha/enterprise.js

def detect_enterprise(page_url):
    """Detect if page uses reCAPTCHA Enterprise."""
    resp = requests.get(page_url, timeout=15)
    return "recaptcha/enterprise.js" in resp.text


# Submit with enterprise flag
is_enterprise = detect_enterprise("https://example.com")

data = {
    "key": "YOUR_API_KEY",
    "method": "userrecaptcha",
    "googlekey": sitekey,
    "pageurl": "https://example.com",
    "json": 1,
}

if is_enterprise:
    data["enterprise"] = 1

resp = requests.post("https://ocr.captchaai.com/in.php", data=data)

Handling Invisible reCAPTCHA

def detect_invisible(html):
    """Detect invisible reCAPTCHA."""
    indicators = [
        'data-size="invisible"',
        "grecaptcha.execute(",
        "recaptcha/api.js?render=",
    ]
    return any(i in html for i in indicators)


# Submit with invisible flag
data = {
    "key": "YOUR_API_KEY",
    "method": "userrecaptcha",
    "googlekey": sitekey,
    "pageurl": "https://example.com",
    "invisible": 1,
    "json": 1,
}

Dynamic Sitekey Extraction

Some sites load sitekeys via JavaScript. Use a browser to extract them:

from selenium import webdriver
from selenium.webdriver.common.by import By


def extract_dynamic_sitekey(url):
    """Extract sitekey from JavaScript-rendered page."""
    driver = webdriver.Chrome()
    driver.get(url)

    # Wait for reCAPTCHA to load
    import time
    time.sleep(3)

    # Try data-sitekey attribute
    elements = driver.find_elements(By.CSS_SELECTOR, "[data-sitekey]")
    if elements:
        sitekey = elements[0].get_attribute("data-sitekey")
        driver.quit()
        return sitekey

    # Try iframe src parameter
    iframes = driver.find_elements(By.CSS_SELECTOR, "iframe[src*='recaptcha']")
    for iframe in iframes:
        src = iframe.get_attribute("src")
        import re
        match = re.search(r'[?&]k=([^&]+)', src)
        if match:
            driver.quit()
            return match.group(1)

    driver.quit()
    return None

Troubleshooting

Issue Cause Fix
Key looks correct but error persists Enterprise sitekey Add enterprise=1
Key changes between visits Dynamic sitekey Extract fresh key each time
Multiple sitekeys on page Wrong one selected Match key to the correct form
Key from CDN iframe Wrong domain's key Extract from main page, not iframe
Empty sitekey extracted JavaScript-rendered Use Selenium to extract

FAQ

What does a valid sitekey look like?

A reCAPTCHA sitekey is typically 40 characters of alphanumeric text plus hyphens. Example: 6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-.

Can the same sitekey work for both v2 and v3?

No. v2 and v3 use different sitekeys. Check the reCAPTCHA script source to determine the version.

Should I cache the sitekey?

Cache for short periods (minutes to hours). Some sites rotate keys. If solving starts failing, re-extract the sitekey.



Get the right sitekey — solve with CaptchaAI.

Discussions (0)

No comments yet.

Related Posts

Reference CAPTCHA Token Injection Methods Reference
Complete reference for injecting solved CAPTCHA tokens into web pages.

Complete reference for injecting solved CAPTCHA tokens into web pages. Covers re CAPTCHA, Turnstile, and Cloud...

Automation Python reCAPTCHA v2
Apr 08, 2026
Tutorials Pytest Fixtures for CaptchaAI API Testing
Build reusable pytest fixtures to test CAPTCHA-solving workflows with Captcha AI.

Build reusable pytest fixtures to test CAPTCHA-solving workflows with Captcha AI. Covers mocking, live integra...

Automation Python reCAPTCHA v2
Apr 08, 2026
Reference Browser Session Persistence for CAPTCHA Workflows
Manage browser sessions, cookies, and storage across CAPTCHA-solving runs to reduce repeat challenges and maintain authenticated state.

Manage browser sessions, cookies, and storage across CAPTCHA-solving runs to reduce repeat challenges and main...

Automation Python reCAPTCHA v2
Feb 24, 2026
Integrations Browser Profile Isolation + CaptchaAI Integration
Browser profile isolation tools create distinct browser environments with unique fingerprints per session.

Browser profile isolation tools create distinct browser environments with unique fingerprints per session. Com...

Automation Python reCAPTCHA v2
Feb 21, 2026
Tutorials Securing CaptchaAI Credentials in Environment Variables
Store Captcha AI API keys securely using environment variables, .env files, Docker secrets, and cloud secret managers instead of hardcoding.

Store Captcha AI API keys securely using environment variables, .env files, Docker secrets, and cloud secret m...

Automation Python reCAPTCHA v2
Feb 12, 2026
Comparisons WebDriver vs Chrome DevTools Protocol for CAPTCHA Automation
Compare Web Driver and Chrome Dev Tools Protocol (CDP) for CAPTCHA automation — detection, performance, capabilities, and when to use each with Captcha AI.

Compare Web Driver and Chrome Dev Tools Protocol (CDP) for CAPTCHA automation — detection, performance, capabi...

Automation Python reCAPTCHA v2
Mar 27, 2026
Use Cases CAPTCHA Solving in Ticket Purchase Automation
How to handle CAPTCHAs on ticketing platforms Ticketmaster, AXS, and event sites using Captcha AI for automated purchasing workflows.

How to handle CAPTCHAs on ticketing platforms Ticketmaster, AXS, and event sites using Captcha AI for automate...

Automation Python reCAPTCHA v2
Feb 25, 2026
Tutorials Caching CAPTCHA Tokens for Reuse
Cache and reuse CAPTCHA tokens with Captcha AI to reduce API calls and costs.

Cache and reuse CAPTCHA tokens with Captcha AI to reduce API calls and costs. Covers token lifetimes, cache st...

Automation Python reCAPTCHA v2
Feb 15, 2026
Use Cases Event Ticket Monitoring with CAPTCHA Handling
Build an event ticket availability monitor that handles CAPTCHAs using Captcha AI.

Build an event ticket availability monitor that handles CAPTCHAs using Captcha AI. Python workflow for checkin...

Automation Python reCAPTCHA v2
Jan 17, 2026
Explainers reCAPTCHA v2 Invisible: Trigger Detection and Solving
Detect and solve re CAPTCHA v 2 Invisible challenges with Captcha AI — identify triggers, extract parameters, and handle auto-invoked CAPTCHAs.

Detect and solve re CAPTCHA v 2 Invisible challenges with Captcha AI — identify triggers, extract parameters,...

Automation Python reCAPTCHA v2
Apr 07, 2026
Troubleshooting GeeTest v3 Error Codes: Complete Troubleshooting Reference
Complete reference for Gee Test v 3 error codes — from registration failures to validation errors — with causes, fixes, and Captcha AI-specific troubleshooting.

Complete reference for Gee Test v 3 error codes — from registration failures to validation errors — with cause...

Automation Testing GeeTest v3
Apr 08, 2026
Troubleshooting Turnstile Token Invalid After Solving: Diagnosis and Fixes
Fix Cloudflare Turnstile tokens that come back invalid after solving with Captcha AI.

Fix Cloudflare Turnstile tokens that come back invalid after solving with Captcha AI. Covers token expiry, sit...

Python Cloudflare Turnstile Web Scraping
Apr 08, 2026
Troubleshooting Common GeeTest v3 Errors and Fixes
Diagnose the most common Gee Test v 3 errors — stale challenge, bad parameters, validation failures — and fix them with practical troubleshooting steps.

Diagnose the most common Gee Test v 3 errors — stale challenge, bad parameters, validation failures — and fix...

Automation Testing GeeTest v3
Jan 24, 2026