xvrh / puppeteer-dart

A Dart library to automate the Chrome browser over the DevTools Protocol. This is a port of the Puppeteer API
BSD 3-Clause "New" or "Revised" License
230 stars 58 forks source link

targetFilter implementation #321

Open wolf-coder opened 3 months ago

wolf-coder commented 3 months ago

Anyway to simulate|implement the filtertargetparameter existing in the Javascript puppeteer library?

This is play a role as being part of the only current way to work around the Cloudflare challenge. This js Solution worked for me:

const puppeteer = require('puppeteer-extra');
const StealthPlugin = require('puppeteer-extra-plugin-stealth');
puppeteer.use(StealthPlugin());
(async () => {
  const browser = await puppeteer.launch({
    headless: false,
    targetFilter: target => !!target.url(),
  });
  var page = await browser.pages();
  page = page[0];
  await page.goto('https://nopecha.com/demo/cloudflare');
})();