Invisible reCAPTCHA v2 operates without user interaction — no checkbox, no image challenge (unless suspicious behavior is detected). It executes programmatically on form submit or button click. When submitting to CaptchaAI, you must include the invisible=1 parameter.
Prerequisites
| Item | Value |
|---|---|
| CaptchaAI API key | From captchaai.com |
| Node.js | 14+ |
| Libraries | axios, puppeteer |
Step 1: Detect the site key
const puppeteer = require('puppeteer');
const axios = require('axios');
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://example.com/login');
// Extract site key and check if invisible
const siteKey = await page.$eval('[data-sitekey]', (el) => el.getAttribute('data-sitekey'));
const isInvisible = await page.$eval('[data-sitekey]', (el) => el.getAttribute('data-size') === 'invisible');
console.log(`Site key: ${siteKey}, Invisible: ${isInvisible}`);
Step 2: Submit to CaptchaAI
const API_KEY = 'YOUR_API_KEY';
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
const { data: submitData } = await axios.get('https://ocr.captchaai.com/in.php', {
params: {
key: API_KEY,
method: 'userrecaptcha',
googlekey: siteKey,
pageurl: page.url(),
invisible: 1,
json: 1,
},
});
if (submitData.status !== 1) throw new Error(submitData.request);
const taskId = submitData.request;
console.log(`Task submitted: ${taskId}`);
Step 3: Poll for the token
await sleep(15000);
let token;
for (let i = 0; i < 30; i++) {
const { data: pollData } = await axios.get('https://ocr.captchaai.com/res.php', {
params: { key: API_KEY, action: 'get', id: taskId, json: 1 },
});
if (pollData.status === 1) {
token = pollData.request;
console.log(`Token: ${token.slice(0, 50)}...`);
break;
}
if (pollData.request !== 'CAPCHA_NOT_READY') {
throw new Error(pollData.request);
}
await sleep(5000);
}
Step 4: Inject and submit
// Inject the token
await page.evaluate((t) => {
document.getElementById('g-recaptcha-response').innerHTML = t;
}, token);
// Check for callback and execute if present
const hasCallback = await page.evaluate(() => {
const el = document.querySelector('[data-callback]');
return el ? el.getAttribute('data-callback') : null;
});
if (hasCallback) {
await page.evaluate((cb, t) => window[cb](t), hasCallback, token);
}
// Submit the form
await page.click('form [type="submit"]');
console.log('Form submitted with solved invisible reCAPTCHA');
await browser.close();
Complete working example
const puppeteer = require('puppeteer');
const axios = require('axios');
const API_KEY = 'YOUR_API_KEY';
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
async function solveInvisibleRecaptcha() {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://example.com/login');
// 1. Get site key
const siteKey = await page.$eval('[data-sitekey]', (el) => el.getAttribute('data-sitekey'));
// 2. Submit to CaptchaAI
const { data: submit } = await axios.get('https://ocr.captchaai.com/in.php', {
params: {
key: API_KEY, method: 'userrecaptcha', googlekey: siteKey,
pageurl: page.url(), invisible: 1, json: 1,
},
});
const taskId = submit.request;
// 3. Poll for token
await sleep(15000);
let token;
for (let i = 0; i < 30; i++) {
const { data: poll } = await axios.get('https://ocr.captchaai.com/res.php', {
params: { key: API_KEY, action: 'get', id: taskId, json: 1 },
});
if (poll.status === 1) { token = poll.request; break; }
if (poll.request !== 'CAPCHA_NOT_READY') throw new Error(poll.request);
await sleep(5000);
}
// 4. Inject and submit
await page.evaluate((t) => {
document.getElementById('g-recaptcha-response').innerHTML = t;
}, token);
await page.click('form [type="submit"]');
console.log('Solved invisible reCAPTCHA');
await browser.close();
}
solveInvisibleRecaptcha().catch(console.error);
FAQ
Is the invisible=1 flag required?
Yes. Without it, CaptchaAI may process the request as standard reCAPTCHA v2, which can lead to failed solves.
How do I know if a site uses invisible reCAPTCHA?
Look for data-size="invisible" on the reCAPTCHA div, or check if the widget is positioned off-screen in the CSS.
Can I solve this without a browser?
Yes. If you know the site key and page URL, you can submit directly with requests/axios and use the token in your HTTP requests.
Discussions (0)
Join the conversation
Sign in to share your opinion.
Sign InNo comments yet.