Skip to main content
Version: Next

playwrightBrowserPool

Callable


  • Builds a BrowserPool of Playwright browsers to pass to a PlaywrightCrawler as its browserPool.

    It accepts every BrowserPool option plus the crawler's own launchContext and headless, and derives the browser plugin from them - so a pool built here always matches the crawler it is given to, and configuring one never means assembling a PlaywrightPlugin by hand.

    Example usage:

    const crawler = new PlaywrightCrawler({
    browserPool: playwrightBrowserPool({
    maxOpenPagesPerBrowser: 1,
    launchContext: { launcher: firefox },
    }),
    requestHandler: async ({ page }) => { ... },
    });

    The returned pool is not torn down by the crawler, which is what makes it shareable between crawlers.


    Parameters

    Returns PlaywrightBrowserPool