admin管理员组

文章数量:1122832

I can't solve the Cloudflare "am i human" captcha, in my puppeteer headful browser, either manually or with a bypass extension, it used to work perfectly with the bypass chrome extension until one day it decided to go in loops.

Suspicion: I had the same problem on normal chrome (Not automated) after installing a proxy manager extension, clearing browser data doesn't help, only deleting the extension works, Also i had the same problem after installing captcha solving extensions...

What I've tried: Chrome works but without extensions, I still have a problem with puppeteer, I tried running puppeteer with different browsers, chrome, chromium, brave, opera... no luck, i tried setting custom user agents no luck, I tried custom headers nothing, i also tried clearing cache and cookies before visiting my targeted website also nothing.

I use puppeteer-extra and puppeteer-extra-plugin-stealth.

Minimal version of my code:

const puppeteerExtra = require("puppeteer-extra");
const Stealth = require("puppeteer-extra-plugin-stealth");

puppeteerExtra.use(Stealth());

const appointementURL =
  ";;

(async () => {
  const browser = await puppeteerExtra.launch({
    headless: false, // Show the browser window
    args: ["--proxy-server=pr.oxylabs.io:7777"], // Add the proxy server to the args
  });

  const page = await browser.newPage();

  // Set User Agent and Headers
  await page.setUserAgent(
    "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
  );
  await page.setExtraHTTPHeaders({
    "Accept-Language": "en-US,en;q=0.9",
  });

  // Authenticate with proxy credentials
  await page.authenticate({
    username: "user",
    password: "pass",
  });

  await page.goto(appointementURL, {
    waitUntil: "networkidle2",
    timeout: 0, // Wait until network is idle
  });

  // Wait for the email input field to load
  await page.waitForSelector("#username");
  await page.type("#username", "email"); // Replace with your email

  // Wait for the password input field to load
  await page.waitForSelector("#password");
  await page.type("#password", "password"); // Replace with your password

  // Click the login button
  await page.waitForSelector("#kc-login");
  await page.click("#kc-login");

  // Optional: Wait for navigation after login
  await page.waitForNavigation({ waitUntil: "networkidle2", timeout: 0 });

  await page.screenshot({ path: "appointment.png" });
  // await browser.close();
})();

I get stuck here even if i solve it manually, it goes in loops: Cloudflare page

本文标签: nodejsPuppeteer js stuck on infinite CloudFlare Human captchaStack Overflow