Explainers

reCAPTCHA v2 Invisible: Trigger Detection and Solving

reCAPTCHA v2 Invisible has no visible checkbox. It activates automatically when a user submits a form or clicks a button, and only shows a challenge if Google's risk analysis detects suspicious behavior. This makes it harder to detect in automation — you might not realize there's a CAPTCHA until your form submission fails.


How Invisible reCAPTCHA differs from standard v2

Feature reCAPTCHA v2 Standard reCAPTCHA v2 Invisible
Visible widget Yes (checkbox) No (badge only)
User interaction Click checkbox Automatic on form submit
data-size normal or compact invisible
Challenge popup Always possible Only for suspicious users
DOM element .g-recaptcha div .g-recaptcha div or programmatic

Detecting Invisible reCAPTCHA

Method 1: Check data-size attribute

// Browser console
const widgets = document.querySelectorAll('.g-recaptcha');
widgets.forEach((el, i) => {
  const size = el.getAttribute('data-size');
  const sitekey = el.getAttribute('data-sitekey');
  console.log(`Widget ${i}: size=${size}, sitekey=${sitekey}`);
  if (size === 'invisible') {
    console.log('  → This is Invisible reCAPTCHA');
  }
});

Method 2: Check for the badge

Invisible reCAPTCHA shows a small badge in the corner:

const badge = document.querySelector('.grecaptcha-badge');
if (badge) {
  console.log('reCAPTCHA badge found — likely Invisible reCAPTCHA');
  console.log('Badge visibility:', getComputedStyle(badge).visibility);
}

Method 3: Check grecaptcha.execute calls

If the page uses programmatic invocation (no .g-recaptcha div):

// Look for grecaptcha.execute in page scripts
document.querySelectorAll('script:not([src])').forEach(s => {
  if (s.textContent.includes('grecaptcha.execute')) {
    console.log('Found grecaptcha.execute — Invisible reCAPTCHA');
    const match = s.textContent.match(/grecaptcha\.execute\s*\(\s*['"]?([^'",\s)]+)/);
    if (match) console.log('Sitekey:', match[1]);
  }
});

Method 4: Check script tag render parameter

document.querySelectorAll('script[src*="recaptcha"]').forEach(s => {
  if (s.src.includes('render=') && !s.src.includes('render=explicit')) {
    console.log('Invisible/v3 reCAPTCHA detected in script:', s.src);
  }
});

Solving with CaptchaAI

The key difference: pass invisible=1 to CaptchaAI so the solver knows it's handling an Invisible variant.

Python

import requests
import time

API_KEY = "YOUR_API_KEY"

# Submit with invisible flag
resp = requests.post("https://ocr.captchaai.com/in.php", data={
    "key": API_KEY,
    "method": "userrecaptcha",
    "googlekey": "6Le-SITEKEY",
    "pageurl": "https://example.com/login",
    "invisible": "1",  # critical for Invisible reCAPTCHA
    "json": "1",
}).json()

if resp["status"] != 1:
    raise Exception(f"Submit error: {resp['request']}")

task_id = resp["request"]
print(f"Submitted: {task_id}")

# Poll for result
for _ in range(24):
    time.sleep(5)
    result = requests.get("https://ocr.captchaai.com/res.php", params={
        "key": API_KEY, "action": "get", "id": task_id, "json": "1"
    }).json()

    if result["status"] == 1:
        print(f"Token: {result['request'][:50]}...")
        break
    if result["request"] != "CAPCHA_NOT_READY":
        raise Exception(f"Error: {result['request']}")

JavaScript

const axios = require('axios');

const resp = await axios.post('https://ocr.captchaai.com/in.php', null, {
  params: {
    key: 'YOUR_API_KEY',
    method: 'userrecaptcha',
    googlekey: '6Le-SITEKEY',
    pageurl: 'https://example.com/login',
    invisible: 1,
    json: 1,
  }
});
const taskId = resp.data.request;
console.log(`Submitted: ${taskId}`);

Token injection for Invisible reCAPTCHA

Invisible reCAPTCHA is typically bound to a button or form submit. After injection, you need to trigger the callback or submit the form:

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

driver = webdriver.Chrome()
driver.get("https://example.com/login")

# After solving, inject and trigger
driver.execute_script("""
    // Set the token
    document.querySelector('textarea[name="g-recaptcha-response"]').value = arguments[0];

    // Find and trigger the callback
    var widget = document.querySelector('.g-recaptcha');
    var callbackName = widget ? widget.getAttribute('data-callback') : null;

    if (callbackName && typeof window[callbackName] === 'function') {
        window[callbackName](arguments[0]);
    }
""", token)

# Submit the form
driver.find_element(By.CSS_SELECTOR, "form#login").submit()

Identifying the trigger element

Invisible reCAPTCHA can be bound to a specific button:

<button class="g-recaptcha"
        data-sitekey="6Le-SITEKEY"
        data-callback="onSubmit"
        data-size="invisible">
  Submit
</button>

Or activated programmatically:

// Site's code
document.getElementById('submit-btn').addEventListener('click', function() {
  grecaptcha.execute();
});

Check both patterns:

// Find elements with g-recaptcha class that are buttons
document.querySelectorAll('button.g-recaptcha, input.g-recaptcha').forEach(el => {
  console.log('Trigger element:', el.tagName, el.textContent.trim());
  console.log('  data-sitekey:', el.getAttribute('data-sitekey'));
  console.log('  data-callback:', el.getAttribute('data-callback'));
});

Troubleshooting

Problem Cause Fix
Token rejected Missing invisible=1 in submit Add invisible: "1" to CaptchaAI request
Can't find sitekey No .g-recaptcha div Check for programmatic grecaptcha.render() or grecaptcha.execute() calls
Form submits but fails Callback not triggered Find and call the data-callback function
CAPTCHA not detected Only appears for suspicious traffic Check for grecaptcha-badge element or recaptcha script tags

FAQ

How do I tell apart Invisible v2 from v3?

Invisible v2 uses grecaptcha.execute() without an action parameter. v3 uses grecaptcha.execute(sitekey, {action: 'submit'}) with an action. Also, v3 uses render=SITEKEY in the script URL.

Does forgetting the invisible flag matter?

Yes. Without invisible=1, the solver may try a different solving approach that produces tokens rejected by the site.

Can I solve Invisible reCAPTCHA without a browser?

Yes — you only need the sitekey and page URL. The browser is only needed to inject the token and trigger the callback.


Solve reCAPTCHA v2 Invisible seamlessly with CaptchaAI

Get your API key at captchaai.com.


Discussions (0)

No comments yet.