Puppeteer-extra: Unable to detect recaptcha

Created on 17 Jan 2020  路  7Comments  路  Source: berstend/puppeteer-extra

So im trying to make it solve a captcha on this site
It wont even find the captcha. Here is my code:

async function nakedCPH(){
const browser = await puppeteer.launch({headless:false});
const page = await browser.newPage();
await page.setUserAgent('5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36');
await page.goto('https://www.nakedcph.com/auth/view?op=register');
await page.waitFor('#auth > form > span > button');
await page.type('#firstNameInput', 'Firstname');
await page.type('#emailInput', "Lastname");
await page.type('#passwordInput', 'pass');
await page.click('#terms > span.custom-control-indicator');
await page.click('#auth > form > span > button');
await page.waitFor(3000);

let { captchas, error } = await page.findRecaptchas();
console.log(captchas);
console.log(error);
};
nakedCPH();

It prints: [] null

Based on the findRecaptchas() method, it looks for
script[src^="https://www.google.com/recaptcha/api.js"] which this site has and you can literally open dev tools and see it in the dom. Im really confused why it cant pick it up, help would be appreciated.

Most helpful comment

I have the same problem.

All 7 comments

Sorry for formatting^^

ahhhaaaa sneakerbots

did you check if the recaptcha is loaded in another frame?

Yes i did the loop through all the frames and it didn't find any :(

anyone know whats the deal?

Absolute shot in the dark here, but maybe you are looking for a captcha before it is loaded into the dom? Try to call your await page.findRecaptchas() after the "domcontentloaded" event is triggered.

I have the same problem.

This issue is quite old and the recaptcha plugin updated quite a bit since then (currently at v3.2.0).

In general the reCAPTCHA box must be _visible_ or "active" to be detected by the plugin.

Be aware that the reCAPTCHA can be in a frame as well which needs to be manually triggered then:

// Loop over all potential frames on that page
for (const frame of page.mainFrame().childFrames()) {
  // Attempt to solve any potential reCAPTCHAs in those frames
  await frame.solveRecaptchas()
}

If there are still issues in this regard with the latest plugin version please confirm with a screenshot that the reCAPTCHA is actually being shown, if that's the case please open a new issue.

Was this page helpful?
0 / 5 - 0 ratings