i'm a girl
i'm a girl

Reputation: 328

Puppeteer multiple browsers or pages

I am trying to crawl about 50 pages with puppeteer, and right now I am doing one after another in a single browser, single page. To make this faster, should I use more pages or more browsers?

Upvotes: 1

Views: 859

Answers (1)

Benjamin Howe
Benjamin Howe

Reputation: 84

I don't think you want to use either:

  • Using more pages isn't great because your browser will build up a history. This may not be what you intend.
  • Using more browsers isn't great because creating a new browser is a fairly expensive operation.

I think you want to use Browser Contexts. Think of a browser context as an incognito window - you can open it quickly, but it doesn't share history, cookies, etc. with other contexts.

Upvotes: 1

Related Questions