Solving Invisible reCAPTCHA with Playwright

Solving Invisible reCAPTCHA with Playwright

Posted on 2026-09-21 | 2 min read | Category: Playwright | By DeathByCaptcha Engineering Team

Playwright


Invisible reCAPTCHA runs in the background without a visible checkbox. It triggers when a user interacts with the page (clicks a button, submits a form). For automation, invisible reCAPTCHA requires different handling than the visible checkbox version.

How Invisible reCAPTCHA Works

  1. The page loads with an invisible reCAPTCHA badge.
  2. When the user clicks submit, reCAPTCHA runs its challenge in the background.
  3. If the score is low, a visible challenge appears.
  4. The token is injected into g-recaptcha-response.

Detecting Invisible reCAPTCHA

# Check for invisible reCAPTCHA
badge = page.query_selector(".grecaptcha-badge")
if badge:
    print("Invisible reCAPTCHA detected")
    sitekey = page.eval_on_selector(".grecaptcha-badge", "el => el.dataset.sitekey")

Solving with DeathByCaptcha

Invisible reCAPTCHA uses type=4:

import json
from playwright.sync_api import sync_playwright
import deathbycaptcha

client = deathbycaptcha.SocketClient(username, password)

with sync_playwright() as p:
    browser = p.chromium.launch(headless=True)
    page = browser.new_page()
    page.goto("https://example.com/form")

    sitekey = page.eval_on_selector(".grecaptcha-badge", "el => el.dataset.sitekey")

    result = client.decode(type=4, token_params=json.dumps({
        "googlekey": sitekey,
        "pageurl": "https://example.com/form"
    }))
    print("Solution:", result["text"])

    page.evaluate("document.querySelector(\"#g-recaptcha-response\").value=\"%s\"" % result["text"])
    page.evaluate("typeof ___grecaptcha_cfg !== \"undefined\" && Object.keys(___grecaptcha_cfg.clients).forEach(function(key) { ___grecaptcha_cfg.clients[key].callback(\"%s\") })" % result["text"])

    page.click("button[type=submit]")

    browser.close()

Key Differences from Visible reCAPTCHA

  • Type parameter: Use type=4 for invisible, type=4 for visible checkbox.
  • No checkbox: There is no iframe checkbox to interact with.
  • Badge detection: Look for .grecaptcha-badge instead of the checkbox iframe.
  • Callback injection: Some sites require calling the reCAPTCHA callback function directly.

reCAPTCHA Enterprise

Enterprise invisible reCAPTCHA adds scoring. The solving process is the same, but the token includes enterprise-specific fields. Pass the enterprise flag in your API call:

result = client.decode(type=4, token_params=json.dumps({
    "googlekey": sitekey,
    "pageurl": page_url,
    "enterprise": True
}))

Troubleshooting

  • Token not working: Ensure you inject into the correct element. Invisible reCAPTCHA may use a hidden textarea.
  • Callback errors: Some sites check if the callback was triggered programmatically. Use headed mode.
  • Score too low: Enterprise reCAPTCHA may reject tokens with low scores. Increase timeout for better solving.

For API documentation, see the API reference and client libraries.

Common pitfalls

  • Using a CAPTCHA solving service for illegitimate purposes instead of legitimate automation and testing.
  • Hard-coding credentials or API keys in client-side code that users can inspect.
  • Sending the wrong CAPTCHA type parameter, which returns incorrect or empty responses.
  • Failing to poll for the solution status and not handling timeouts gracefully.
  • Scaling automation without monitoring error rates, response times, and CAPTCHA type coverage.
DBC
Written by DeathByCaptcha Engineering Team
DeathByCaptcha engineers build and operate the CAPTCHA solving technology behind this site. Articles are written by our technical team and checked for accuracy before publishing.
Reviewed by DeathByCaptcha Editorial Team

Get your API key — start solving

Free to try · No credit card · Python, Node.js, Java, C# SDKs

Get your API key


Status: OK

Servers are fully operational with faster than average response time.
  • Average solving time
  • 1 seconds - Normal CAPTCHAs (1 min. ago)
  • 21 seconds - reCAPTCHA V2, V3 (1 min. ago)
  • 20 seconds - others (1 min. ago)
Chrome and Firefox logos
Browser extensions available

Updates

  1. May 13: Crypto payments got better! You can now purchase your CAPTCHAs using cryptocurrency through the Hekelet payment processor at https://deathbycaptcha.com/user-pay and receive an extra 20% FREE CAPTCHA credit with every package purchased this way.
  2. Apr 15: GitHub Updates: We’ve upgraded our libraries, expanded sample code, enhanced documentation, and added support for C++ and Go, making integration smoother than ever. Explore what’s new at github.com/deathbycaptcha!
  3. Jan 27: RESOLVED - If your email to one of our official addresses ([email protected], [email protected], or [email protected]) has bounced or you haven’t received a response, please try resending it or reach out via our Live Chat Support at https://deathbycaptcha.com/es/contact.

  4. Previous updates…

Support

Our system is designed to be completely user-friendly and easy-to-use. Should you have any trouble with it, simply email us at DBC technical support emailcom, and a support agent will get back to you as soon as possible.

Live Support

Available Monday to Friday (10am to 4pm EST) Live support image. Link to live support page