hoangvu12 – 15-41 Feb 1

I want to make a script using puppeteer, go to a CF website, solve the captcha manually then get the cookies. The problem is I can't seem to solve the captcha, whenever I click on "Verify", it show the loading spinner for 1-2 seconds then refresh the page. Here is the code:
import puppeteer from "puppeteer-extra";
import StealthPlugin from "puppeteer-extra-plugin-stealth";

puppeteer.use(StealthPlugin());

puppeteer
.launch({
headless: false,
})
.then(async (browser) => {
console.log("Running tests..");
const page = await browser.newPage();
await page.goto(
"https://example.com"
);

console.log("Waiting for the page to load..");

await page.waitForRequest((request) => {
return (
request.url() ===
"https://example.com" &&
request.method() === "POST"
);
});

const cookies = await page.cookies();

console.log(cookies);

console.log(`All done, check the screenshot`);
});
import puppeteer from "puppeteer-extra";
import StealthPlugin from "puppeteer-extra-plugin-stealth";

puppeteer.use(StealthPlugin());

puppeteer
.launch({
headless: false,
})
.then(async (browser) => {
console.log("Running tests..");
const page = await browser.newPage();
await page.goto(
"https://example.com"
);

console.log("Waiting for the page to load..");

await page.waitForRequest((request) => {
return (
request.url() ===
"https://example.com" &&
request.method() === "POST"
);
});

const cookies = await page.cookies();

console.log(cookies);

console.log(`All done, check the screenshot`);
});
UU
Unknown User87d ago