Anas Latique
Anas Latique

Reputation: 408

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?

Upvotes: 0

Views: 2700

Answers (1)

Peyter
Peyter

Reputation: 484

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

Upvotes: 1

Related Questions