clicks-recaptcha-solver
Version:
A powerful automation tool for solving Google reCAPTCHA challenges using Playwright and Puppeteer. This package intelligently detects and simulates human-like interactions, including mouse movements and precise clicks, to bypass reCAPTCHA v2 and other sim
28 lines (23 loc) • 1.08 kB
text/typescript
import { Page } from 'playwright-core';
/**
* Checks if the reCAPTCHA has been successfully passed on the page.
*
* This function iterates through the frames of the page to determine if reCAPTCHA
* has been successfully completed by looking for the presence of the element with 'recaptcha-checkbox-checked' class.
*
* @param {Object} page - The Puppeteer page object containing the reCAPTCHA.
* @returns {Promise<boolean>} - A promise that resolves to true if reCAPTCHA is passed, otherwise false.
*/
export async function isRecaptchaPassed(page: Page): Promise<boolean> {
// Select iframe that contains reCAPTCHA
const frames = await page.frames();
for (let frame of frames) {
// Check for the presence of an element with the 'recaptcha-checkbox-checked' class
// The presence of this element means that the captcha has been successfully completed
const isChecked = (await frame.$('.recaptcha-checkbox-checked')) !== null;
if (isChecked) {
return true;
}
}
return false;
}