fast-facts / puppeteer-pro

A simple puppeteer wrapper to enable useful plugins with ease
MIT License
54 stars 3 forks source link

Captcha not working with most recapcha implementations #789

Closed 41Baloo closed 2 years ago

41Baloo commented 2 years ago

The captcha solver will fail on most recaptcha implementations because it cannot find the captcha.

I assume that's because, unlike https://www.google.com/recaptcha/api2/demo, most people don't have the "https://www.google.com/recaptcha/api2/anchor" embeded directly into the main page but rather load it via https://www.google.com/recaptcha/api.js?hl=en (like https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php for example)

fast-facts commented 2 years ago

Give v1.6.4 a try.

I think the issue was chrome preventing cross frame scripting. I updated the code example in the readme to use https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php as the demo site and added a waitForCaptcha method since that demo site defers loading of the captcha script.

  await page.goto('https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php');
  await solver.waitForCaptcha(page); // Captcha script is deferred, so will load after page.goto completes
  await solver.solveRecaptcha(page);
  await page.screenshot({ path: 'is-recaptcha-solved.png' });
41Baloo commented 2 years ago

Yup. seems to work for me aswell, thanks.

fast-facts commented 2 years ago

Awesome, thanks for confirming.