reCAPTCHA v2 Bypass: Solver Guide
A reCAPTCHA v2 bypass in automated testing comes down to two steps: get a valid response token and pass it to the form. A solver service handles the challenge and returns the token, and your test delivers it the same way the widget would. The backend still verifies that token with Google before it accepts the request. This guide covers both widget versions, where to find the parameters, and how to use CapMonster Cloud from Python and JavaScript.
Key Takeaways
- In practice, the task is to get a valid response token and deliver it to the form. Your backend still verifies that token with Google.
- The checkbox version starts the check when the user clicks the box. The invisible version starts it from a button or from code, and a callback resumes submission once the token arrives.
- Google’s standard v2 token expires after two minutes and can be verified only once. CapMonster Cloud’s token is valid for 60 seconds after solving, so use it right away.
- A RecaptchaV2Task needs only the task type, the page URL and the site key. Proxy, User-Agent and cookies are optional, and CapMonster Cloud documents additional requirements for them in some integrations.
- A valid token doesn’t guarantee that the app will accept the form. Log the solver result, Google’s verification result and the form outcome separately.
Definitions
- Site key (websiteKey). The public key that identifies a reCAPTCHA integration and tells the page which widget to render. CapMonster Cloud calls this field websiteKey.
- g-recaptcha-response. The form field that carries the response token generated by reCAPTCHA. The widget stores the token in a hidden textarea with this name, and the backend uses it to verify the response with Google.
- data-s. An additional single-use value that some custom reCAPTCHA v2 integrations include in the widget’s HTML. It’s separate from the public site key and the response token.
- isInvisible. An optional Boolean field in the CapMonster Cloud API. A value of true indicates that the task is for an invisible v2 widget.
- Task. A request submitted to CapMonster Cloud for asynchronous processing. Each accepted task has an ID that identifies it when you check its status or retrieve its result.
- Token lifetime. The time window in which a response token is eligible for verification. A single-use token can’t be verified again even if that window is still open.
reCAPTCHA Checkbox vs. Invisible reCAPTCHA v2
The main difference between the two reCAPTCHA v2 widget types is what starts the check. With the reCAPTCHA checkbox, the user clicks “I’m not a robot.” Google may accept the click alone or ask the user to complete a challenge. Once the check passes, the widget writes the response token into a hidden field, and the form sends it along on submission.
The invisible version has no checkbox. The check starts when the user clicks an existing button, such as Submit, or when the app triggers it from JavaScript. Google can still show a challenge.
You can tell the two apart from the widget configuration. Invisible mode is set with data-size="invisible" in HTML or size: "invisible" in the JavaScript options. It also relies on a callback. When the check passes, Google calls the function named in data-callback, or the one passed as callback to grecaptcha.render(), and hands it the token. What happens next is up to your code. In a typical integration, the callback resumes the submission. A checkbox widget can have a callback too, but a standard form doesn’t need one to submit.
Both versions share the same server-side verification: the backend sends the token to Google before it accepts the protected request. If you’re adding the widget to a form yourself, see how to integrate reCAPTCHA v2 on your site. Enterprise uses a separate key setup and isn’t covered in this comparison. For that, see our guide to reCAPTCHA Enterprise.
How reCAPTCHA v2 Bypass Works
A solver replaces the person at the challenge step, while the rest of the flow stays the same. From widget to server:
- Widget. The reCAPTCHA widget runs the check in the browser. Google may ask the user to complete a challenge.
- Response token. Once the check passes, the widget returns a token that the page sends with the form. A solver service handles the challenge instead of a person: the CapMonster Cloud reCAPTCHA v2 solver returns the token in the task result.
- Server verification. The application’s backend sends the token and its secret to Google. It uses Google’s response and its own form rules to decide whether to accept the submission.
Token lifetime
Under Google’s server verification rules, a standard v2 response token expires after two minutes and can be verified only once. CapMonster Cloud documents a 60-second window for the token it returns. That window starts when the service solves the challenge, so use the token as soon as you receive it.
What to log in QA
Record the reCAPTCHA v2 solver result, Google’s verification result, and the form outcome separately. This shows where the request failed. See also working methods for solving reCAPTCHA v2 in 2026.
How to Find the Parameters
You need the public site key and the widget mode, plus the data-s value if the integration uses one. You can find them by hand in DevTools.
Manual check
Open the page with the widget, right-click the CAPTCHA and choose Inspect.
On the Elements tab, find the widget container, usually a div with the g-recaptcha class. Its data-sitekey attribute holds the public key you’ll pass as websiteKey. If the element has data-size="invisible", the page uses the invisible version. Some custom integrations also add a data-s attribute. If you see one, pass its value as recaptchaDataSValue, and read a fresh value for every task, because it’s single-use. If the app renders the widget from JavaScript, look for the sitekey and size options passed to grecaptcha.render() instead.
On the Network tab, reload the page and find the request to Google’s reCAPTCHA anchor endpoint. Its k parameter is the site key, and size=invisible in the same request confirms invisible mode. This check helps when the key isn’t visible in the page’s HTML. Keep in mind that reCAPTCHA v3 also loads an invisible widget, so this parameter tells you the mode only once you know the page uses v2.
Automated check
The Playwright example below is written for specific widget markup: Google’s anchor iframe and data attributes on the widget container. It reads the site key and widget mode. Some integrations also include an optional data-s value, which the script reports when it’s present. If your page renders the widget differently, adjust the selectors.
import { chromium } from "playwright";
(async () => {
const browser = await chromium.launch({ headless: false });
const page = await browser.newPage();
await page.goto("https://example.com");
await page.waitForSelector('iframe[src^="https://www.google.com/recaptcha/api2/anchor?"]');
const captchaData = await page.evaluate(() => {
const iframeEl = document.querySelector('iframe[src^="https://www.google.com/recaptcha/api2/anchor?"]');
const captchaUrl = iframeEl?.getAttribute("src");
if (captchaUrl) {
const urlParams = new URLSearchParams(captchaUrl.split("?")[1]);
const sitekey = urlParams.get("k");
const size = urlParams.get("size");
const isInvisible = size === "invisible";
const sitekeyEl = document.querySelector("[data-sitekey]");
const datasEl = document.querySelector("[data-s]");
const datas = datasEl?.getAttribute("data-s");
return {
sitekey: sitekey || sitekeyEl?.getAttribute("data-sitekey"),
datas,
isInvisible,
};
}
return null;
});
console.log(captchaData);
await browser.close();
})();Solve reCAPTCHA v2 with the CapMonster Cloud API
CapMonster Cloud solves standard reCAPTCHA v2 with the RecaptchaV2Task task type. You create a task with createTask, then request the result with getTaskResult. The service processes the task asynchronously, and your application’s own verification and business logic still decide what happens to the form request. The parameters below follow the RecaptchaV2Task documentation.
| Parameter | Required/Optional | Description |
|---|---|---|
| type | Required | Task type. The value is RecaptchaV2Task. |
| websiteURL | Required | URL of the page with reCAPTCHA v2. |
| websiteKey | Required | Public site key for the reCAPTCHA v2 widget. |
| recaptchaDataSValue | Optional | String. One-time data-s value used by some custom reCAPTCHA v2 implementations. Retrieve a fresh value for every task. |
| userAgent | Optional | String. Browser User-Agent used for emulation. Use a modern browser signature. CapMonster Cloud publishes the current supported value (see the configuration notes below). |
| cookies | Optional | String. Additional cookies to use when interacting with the target page or Google. Format: name1=value1; name2=value2. |
| isInvisible | Optional | Boolean. True for invisible reCAPTCHA v2. |
| proxyType | Optional | String. Proxy type: http, https (only if http doesn’t work), socks4, or socks5. |
| proxyAddress | Optional | String. IPv4 or IPv6 address of the proxy. Transparent proxies and proxies on local machines are not allowed. |
| proxyPort | Optional | Integer. Proxy port. |
| proxyLogin | Optional | String. Proxy server login. |
| proxyPassword | Optional | String. Proxy server password. |
When CapMonster Cloud accepts a task, it returns a taskId that identifies it. A successful result contains the reCAPTCHA response token in solution.gRecaptchaResponse. For some sites, the solution also includes a userAgent value. In that case, submit the form with that User-Agent, even if it differs from the one your browser or script uses.
Configuration notes. By default, CapMonster Cloud uses its own proxies, so the proxy fields are needed only if you want to solve through yours. If your proxy uses IP-based authorization, add CapMonster Cloud’s address to the allowlist. At the time of writing, the documentation lists 65.21.190.34. The supported browser User-Agent can change, so check CapMonster Cloud’s current User-Agent reference before running your tests.
reCAPTCHA v2 Python
When a test needs a real token rather than a fixed verifier result, you can call the CapMonster Cloud API directly. This reCAPTCHA v2 Python example involves no browser automation. The script sends createTask, then polls getTaskResult until the task is ready. All you need is the requests library and the two required values from your form: the page URL and the site key.
import time
import requests
API_KEY = "YOUR_API_KEY"
API = "https://api.capmonster.cloud"
def solve_recaptcha_v2(website_url, website_key, timeout=120):
task = requests.post(f"{API}/createTask", json={
"clientKey": API_KEY,
"task": {
"type": "RecaptchaV2Task",
"websiteURL": website_url,
"websiteKey": website_key,
},
}, timeout=30).json()
if task["errorId"]:
raise RuntimeError(task.get("errorCode"))
deadline = time.monotonic() + timeout
while time.monotonic() < deadline:
time.sleep(3)
result = requests.post(f"{API}/getTaskResult", json={
"clientKey": API_KEY,
"taskId": task["taskId"],
}, timeout=30).json()
if result["errorId"]:
raise RuntimeError(result.get("errorCode"))
if result["status"] == "ready":
return result["solution"]
raise TimeoutError("No result from CapMonster Cloud before the deadline")
solution = solve_recaptcha_v2("https://staging.example.com/signup", "YOUR_SITE_KEY")
token = solution["gRecaptchaResponse"]The function returns the whole solution object rather than just the token. For some sites, the solution also includes a userAgent, and the form should then be submitted with that User-Agent. The three-second interval and the roughly two-minute polling window are starting points, so adjust them to fit your test suite. A non-zero errorId from either method stops the run with the API’s error code, which keeps a CapMonster failure from being mistaken for a form error.
Use the token right away. CapMonster Cloud states that it’s valid for 60 seconds after solving, and Google verifies each token only once. Send it to your form endpoint in the g-recaptcha-response field and check the application’s response, not just whether a token came back.
For a full walkthrough that injects the token into the page with a browser, see our step-by-step Python guide with Selenium.
JavaScript Example
In a Playwright test, you can get a token through the CapMonster Cloud SDK and pass it to the page yourself. The test reads the site key from the widget, solves the task, writes the token into the g-recaptcha-response field and, for the invisible version, calls the function named in data-callback. That last step matters. With the invisible widget, the callback is what resumes form submission, so filling in the field alone won’t submit anything.
import { test, expect } from "@playwright/test";
import {
CapMonsterCloudClientFactory, ClientOptions, RecaptchaV2Request,
} from "@zennolab_com/capmonstercloud-client";
const client = CapMonsterCloudClientFactory.Create(
new ClientOptions({ clientKey: process.env.CAPMONSTER_API_KEY })
);
test("signup with invisible reCAPTCHA v2", async ({ page }) => {
test.setTimeout(120_000);
await page.goto("/signup");
await page.getByLabel("Email").fill("qa-run@example.com");
const widget = page.locator("[data-sitekey]");
const result = await client.Solve(new RecaptchaV2Request({
websiteURL: page.url(),
websiteKey: await widget.getAttribute("data-sitekey"),
isInvisible: true,
}));
if (!result.solution) throw new Error(`CapMonster Cloud error: ${result.error}`);
const token = result.solution.gRecaptchaResponse;
await page.evaluate((token) => {
document.querySelector("#g-recaptcha-response").value = token;
const name = document.querySelector("[data-sitekey]").dataset.callback;
window[name](token);
}, token);
await expect(page.getByText("Check your inbox")).toBeVisible();
});The example assumes the widget is declared in HTML with data-sitekey and data-callback. Google requires data-callback to name a global function, which is why the test can call it through window. If your app renders the widget with grecaptcha.render() instead, call the callback your code passes there. For the checkbox version, drop isInvisible and submit the form the way your app normally does. Replace the route, field label and confirmation text with the ones your form uses. The relative /signup path assumes baseURL is set in your Playwright config.
Keep solving and submission close together, because CapMonster Cloud’s token is valid for 60 seconds. The final assertion checks what the user sees, so pair it with a backend check that the signup record exists.
For the same flow with Selenium WebDriver, see our JavaScript guide with Selenium.
Token Injection: Three Methods
Once you have a token, the rest of how to bypass reCAPTCHA v2 comes down to delivery. There are three ways to get the token to your application. Which one fits depends on how the form is built and which part of the flow the test should cover.
Writing the token into g-recaptcha-response
The widget keeps its response in a hidden textarea with the id g-recaptcha-response, and a standard form sends that field along with the rest of its data. A test can set the textarea’s value from page script and then submit the form as usual. This works for the checkbox version when the form posts normally and doesn’t wait for a callback.
await page.evaluate((token) => {
document.querySelector("#g-recaptcha-response").value = token;
}, token);Calling the data-callback function
With the invisible version, filling in the field isn’t enough, because the form waits for the widget’s callback before it continues. Read the function name from the data-callback attribute and call it with the token. Google requires that attribute to name a global function, so the test can reach it through window. If your app renders the widget with grecaptcha.render(), call the callback your code passes there instead. If the form also reads the textarea, set the field first.
await page.evaluate((token) => {
const name = document.querySelector("[data-sitekey]").dataset.callback;
window[name](token);
}, token);Sending g-recaptcha-response in an HTTP request
Without a browser, you can post the form data straight to your endpoint and include the token in the g-recaptcha-response field. This is the quickest way to test the backend, but the request has to match what the page would send. That means the same session cookies, any CSRF token the form requires and, if CapMonster Cloud returned a userAgent, that User-Agent header. Your backend still verifies the token with Google, so this method covers server-side verification but not the widget or the page’s own JavaScript.
Why the Token Is Rejected
When a submission fails, first work out which check failed. Google may have rejected the token, or your own validation or authorization logic may have rejected the form. The server logs for the request usually answer that faster than the browser, where a single alert can cover several different errors.
Expired or reused token. Google accepts a standard v2 token for two minutes and verifies it only once. CapMonster Cloud counts its 60-second validity from the moment the task is solved. Google reports both cases as timeout-or-duplicate, so the code alone won’t tell you which one you hit. Check how much time passed between solving and submission, and how many requests carried the same token. Automatic retries, double clicks and parallel submissions can all send one token twice.
Outdated User-Agent. This problem appears on the client side, before a token is issued, not during server-side verification. If the userAgent you pass to CapMonster Cloud isn’t a supported browser signature, Google may ask you to “update your browser” instead of completing the check. CapMonster Cloud publishes the current value in its User-Agent reference.
Mismatched proxy, User-Agent or cookies. Google’s SiteVerify request takes the secret, the response token and an optional remoteip. User-Agent and cookies aren’t among its documented parameters. CapMonster Cloud, however, documents additional requirements for some integrations. If you solve the task through your own proxy, use the same proxy when you submit the token. If the solution includes a userAgent, submit the form with that User-Agent, even if it differs from the one your browser or script normally uses. For cookies, the documentation recommends passing the ones your automation uses on the target page.
Wrong websiteKey. The websiteKey in the task must be the data-sitekey of the widget on the page you’re testing. A token issued for a different key won’t pass verification with your backend’s secret. This can happen when staging and production use different keys and the test picks up the wrong one from its config. If your integration checks the response hostname, make sure the staging hostname is accepted too.
For other common causes, see reCAPTCHA validation errors and their fixes.
What Does Not Work
Shortcuts that skip the token don’t work, because the backend checks for one. Hiding the widget with CSS, removing it from the page or turning off JavaScript leaves the form without a valid g-recaptcha-response, and server-side verification rejects the request. Reusing an old token fails for a similar reason, since Google verifies each token only once. A token copied from another page or environment won’t help either, because a token produced for one site key doesn’t pass verification for another.
For manual checks, CapMonster Cloud also offers a browser extension for Chrome and Firefox. It works inside the browser session, which makes it convenient when you’re clicking through a form by hand. Automated tests of server-side behavior still need assertions against the application’s response and side effects.
FAQ
CapMonster Cloud
CapMonster Cloud is a cloud service that solves CAPTCHAs automatically. For reCAPTCHA v2, it handles both the checkbox and invisible versions through RecaptchaV2Task and returns a token you can pass to your form. You can connect it through the API or the official SDKs. In a QA workflow, the token is one input to a broader check that also covers server verification, form handling and the expected application outcome.
NB: Please note that the product is intended only for automating tests on your own websites and sites you have legal access to.






