0

I'm using puppeteer with puppeteer-extra-plugin-recaptcha plugin. I want to set a custom timeout for 2captcha solving but I'm having a hard time. The method I use is:

await page.solveRecaptchas()

But I couldn't find anything timeout-related in the plugin documentation, I tried multilpe guess-kind of solutions page.setDefaultTimeout(x) , page.solveRecaptchas({timeout: x}) but none works.

Any help is much appreciated

  • 1
    I can show you a playwright trick to solve google captchas on single click. I don't know about puppeteer though. Let me know if you are interested in the playwright procedure . – Spidy Feb 05 '22 at 19:07

1 Answers1

0

Don't use timeout with timer. Instead check the [aria-checked] of the "checkbox" if this set to true, then continue.

const frame = page.frames().find(async (frame) => await frame.title() === 'reCAPTCHA')

// You can choose between these two methods below

// Try this lines below
const checkmark = await frame.waitForSelector('#recaptcha-anchor', {visible: true})
while (await frame.evaluateHandle((checkmark) => checkmark.getAttribute('aria-checked') !== 'true', checkmark)) {
    await page.waitForTimeout(100)
}

// Or simply this lines below
await frame.waitForFunction(() => {
    return document.querySelector('#recaptcha-anchor').getAttribute('aria-checked') === 'true'
}, {timeout: 0, polling: 100})

// Then you can check
// reCaptcha solved successfully
Edi Imanto
  • 2,119
  • 1
  • 11
  • 17