【问题标题】:How to use puppeteer.connect() in puppeteer-cluster?如何在 puppeteer-cluster 中使用 puppeteer.connect()?
【发布时间】:2020-07-13 10:17:05
【问题描述】:

我想使用远程无头浏览器服务(this one),在文档中他们使用puppeteer.connect() 而不是puppeteer.launch()

这是启动 puppeteer 集群的代码:

  const cluster = await Cluster.launch({
    concurrency: Cluster.CONCURRENCY_PAGE,
    maxConcurrency: 10,
    monitor: true,
    options: {
      timeout: 0,
    }
  });

如何在puppeteer-cluster 中使用 puppeteer.connect()?

【问题讨论】:

  • 我想 browserless.io 有自己的集群来管理多个 puppeteer 工作人员。如果您希望在自己的机器上运行 puppeteer,则可以使用 puppeteer-cluster。
  • 通读他们的文档,您只需连接到他们的 api 并继续发送请求,他们将负责处理多个工作人员以提高性能。
  • 使用 Browserless.io 并不能解决这个问题。

标签: javascript node.js puppeteer google-chrome-headless puppeteer-cluster


【解决方案1】:

连接到已经打开的 Chrome 的用例是什么?

Puppeteer-cluster 为您管理打开、关闭 worker puppeteer 浏览器的整个操作。

看我写的这个例子,语法是正确的,你甚至可以copypasta自己使用。该问题与您的查询无关,但代码,您可以根据需要使用,TD,创建者帮助我想出了它。

enter link description here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-02-16
    • 2020-04-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多