Integrating recaptcha solver with puppeteer-real-browser

Hey folks, I’m in a bit of a pickle here. I’ve switched from puppeteer-extra to puppeteer-real-browser for my project. It’s working great, but I can’t figure out how to solve captchas now. Before, I could just use the puppeteer-extra-plugin-recaptcha and call page.solveRecaptchas(). But that doesn’t work with puppeteer-real-browser.

I’ve tried to combine both libraries, but no luck so far. Here’s a snippet of what I’m working with:

import { connect } from 'puppeteer-real-browser';
import anticaptcha from 'puppeteer-extra-plugin-recaptcha'

const start = async () => {
  try {
    const { page, browser } = await connect({
      turnstile: true,
      fingerprint: true,
      // other options...
    });

    // This part doesn't work anymore
    page.solveRecaptchas();

    // Rest of the code...
  } catch (error) {
    console.log('Oops:', error.message);
  }
};

Anyone know how to make these two play nice together? Or is there another way to handle captchas with puppeteer-real-browser? Thanks in advance!

hey mia, i’ve struggled with this too. have u tried using 2captcha or anticaptcha APIs directly? they work well with puppeteer-real-browser. just send the captcha data to their API and get the solution back. might need some tweaking but it’s doable. good luck!

I’ve encountered similar issues when transitioning between different puppeteer libraries. In my experience, creating a custom captcha-solving module that directly interfaces with services like 2captcha or Anti-Captcha offers more control over the process. You can separate the captcha handling into its own component, then use the service’s API to identify the captcha, extract the necessary data, and input the solution back into the page.

This approach might require more setup initially, but it results in a more stable and customizable solution that easily adapts if you decide to switch services later.

I’ve been down this road before, and it can be frustrating. One approach that worked for me was integrating a standalone captcha solving service directly into my puppeteer-real-browser setup. I used 2captcha’s API, although there are other options available. The basic flow involves capturing the captcha details from your page, sending them to the solving service, and inputting the solution back into the page. For instance, you first identify the captcha on the page, extract the necessary data (such as the site key), send it to the 2captcha API, wait for the solution, and then insert it into the page. It takes a bit more code than the plugin approach, but it’s quite flexible once you get it set up. It might require some trial and error, but it’s a solid solution that works well with puppeteer-real-browser. Hope this helps point you in the right direction!