小编Pey*_*ter的帖子

Puppeteer-Cluster Stealthy 是否足以通过机器人测试?

我想知道是否有人使用 Puppeteer-Cluster 可以详细说明 Cluster.Launch({settings}) 如何防止在不同上下文中的页面之间共享 cookie 和 Web 数据。

此处的浏览器上下文是否确实阻止了 cookie,并且不会共享或跟踪用户数据?Browserless' 现在臭名昭著的页面似乎认为不,这里和 .launch({}) 应该在任务上调用,而不是在队列之前。

所以我的问题是,我们如何知道 puppeteer-cluster 是否在排队任务之间共享 cookie/数据?图书馆中有哪些选项可以降低被贴上机器人标签的机会?

设置:我将 page.authenticate 与代理服务、随机用户代理一起使用,但偶尔仍会被我正在执行测试的站点阻止(403)。

async function run() {
// Create a cluster with 2 workers
  const cluster = await Cluster.launch({
    concurrency: Cluster.CONCURRENCY_BROWSER, //Cluster.CONCURRENCY_PAGE,
    maxConcurrency: 2, //5, //25, //the number of chromes open
    monitor: false, //true,
    puppeteerOptions: {
      executablePath,
      args: [
        "--proxy-server=pro.proxy.net:2222",
        "--incognito",
        "--disable-gpu",
        "--disable-dev-shm-usage",
        "--disable-setuid-sandbox",
        "--no-first-run",
        "--no-sandbox",
        "--no-zygote"
      ],
      headless: false,
      sameDomainDelay: 1000,
      retryDelay: 3000,
      workerCreationDelay: 3000
    }
  });

   // …
Run Code Online (Sandbox Code Playgroud)

automated-tests end-to-end node.js puppeteer puppeteer-cluster

2
推荐指数
1
解决办法
3559
查看次数