An issue I've encountered involves bypassing the captcha and ensuring it's fully processed before attempting any interactions with the page, such as inputting login credentials. Even with the turnstile: true and fingerprint: true configurations enabled, my script attempts to interact with the page immediately after navigation, before the captcha can be resolved. To work around this, I've had to introduce a fixed delay (waitForTimeout(20000); at the start of the initial goto , but im wondering if it can like wait when it sees the cloudfare captcha , currently it solves the captcha but it just tries to find elements on the screen which are not yet available since the captcha is not finished yet . the issue also is that the cloudfare could popup on different times in the process , so i can't wait 20seconds after each step , is there a way to detect the captcha appearing through puppeteer-real-browser ?
const {
browser: browserInstance,
page,
setTarget,
} = await connect({
headless: false,
fingerprint: true, // Injects a unique fingerprint ID into the page
turnstile: true, // Automatically clicks on Captchas
tf: true, // Use targetfilter to avoid detection initially
});
browser = browserInstance;
setTarget({ status: false });
const page2 = await browser.newPage();
setTarget({ status: true });
// Navigate to the appointment page
await page2.goto(
"https://xxx",
{ waitUntil: "domcontentloaded" }
);
// Wait for 5 seconds
await page2.waitForTimeout(20000);
// Login
await page2.focus("#username");
await page2.type("#username", "[email protected]");
await page2.focus("#password");
await page2.type("#password", "xxxxx");