You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何手动调用/查找ReCaptcha回调函数?2captcha结果提交遇阻

How to Submit 2Captcha's ReCaptcha Result to Google & Locate the Callback Function

Let me break this down step by step based on common ReCaptcha implementations and my hands-on experience with 2Captcha:

1. Submitting the 2Captcha Result to Google

First, let's clarify what 2Captcha returns for different ReCaptcha versions—this dictates how you submit it:

  • ReCaptcha v2: You’ll get a long alphanumeric string (the g-recaptcha-response token) from 2Captcha.
  • ReCaptcha v3: You’ll receive a token tied to a user "score" that the site’s backend verifies with Google’s API.

For ReCaptcha v2

Here’s the manual submission workflow:

  • Locate the hidden input field on the target page with the name g-recaptcha-response (it’s usually nested inside the ReCaptcha widget’s container div).
  • Set this input’s value to the token you received from 2Captcha.
  • Either trigger the form’s submit button (if the site uses a standard form) or call the site’s custom ReCaptcha success callback (more on finding that below).

Example code to run in your browser’s console:

// Insert your 2Captcha token here
const captchaToken = "YOUR_2CAPTCHA_RESPONSE_TOKEN";

// Populate the hidden response field
document.querySelector('input[name="g-recaptcha-response"]').value = captchaToken;

// Trigger form submission (adjust the selector to match the site's form ID/class)
document.querySelector('#login-form').submit();

For ReCaptcha v3

v3 runs silently in the background, so you’ll need to mirror the site’s existing API flow:

  • Open your browser’s dev tools (Network tab) and look for POST requests the site sends after ReCaptcha completes—you’ll see a parameter like g-recaptcha-response or token in the payload.
  • Send a request to that same endpoint, replacing the original token with the one from 2Captcha.

2. Locating the ReCaptcha Callback Function

Most sites use one of two methods to handle ReCaptcha success—here’s how to find the callback:

Method 1: Check the Widget’s data-callback Attribute

  • Right-click the ReCaptcha widget, select "Inspect", and look for the parent div with class g-recaptcha. It will have a data-callback attribute with the function name (e.g., data-callback="captchaCompleted").
  • Once you have the function name, call it directly in the console, passing your 2Captcha token as the argument:
    // Replace with the actual callback name from the site
    captchaCompleted("YOUR_2CAPTCHA_TOKEN");
    

Method 2: Find Programmatic Rendering Code

If the widget is rendered via JavaScript (no data-callback in the HTML), search the page’s JS for calls to grecaptcha.render(). This function accepts a callback parameter that defines the success handler.

  • You can also check the global grecaptcha object in the console: grecaptcha.getResponse() will return the current valid token, which you can use to confirm your 2Captcha token is set correctly.

A Quick Note on 2Captcha’s Docs

I get why the official docs feel missing this piece—this submission step isn’t controlled by 2Captcha. It’s entirely dependent on how the target site implements ReCaptcha. 2Captcha only provides the valid token; you just need to mirror the site’s existing validation flow to use it.

内容的提问来源于stack exchange,提问作者PloxCake

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 10:07:51