简体   繁体   中英

How to use puppeteer.connect() in puppeteer-cluster?

I want to use a remote headless browser service (this one) and in the docs they use puppeteer.connect() instead of puppeteer.launch()

this the code to launch the puppeteer cluster:

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

how can I use puppeteer.connect() in puppeteer-cluster ?

What is the use-case for connecting to an already open Chrome?

Puppeteer-cluster manages the whole operation of opening, closing the worker puppeteer browsers for you.

Look at this example I wrote, the syntax is correct, you can even copypasta it and use it yourself. The question is not really relevant to your query, but the code, you can use if you want, TD, the creator helped me come up with it.

enter link description here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM