How to use the puppeteer-core._launcher function in puppeteer-core

To help you get started, we’ve selected a few puppeteer-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Munter / subfont / lib / HeadlessBrowser.js View on Github external
async function downloadOrLocatePreferredBrowserRevision() {
  const browserFetcher = puppeteer.createBrowserFetcher();
  const preferredRevision = puppeteer._launcher._preferredRevision;
  const localRevisions = await browserFetcher.localRevisions();
  let revisionInfo;
  if (localRevisions.includes(preferredRevision)) {
    revisionInfo = await browserFetcher.revisionInfo(preferredRevision);
  } else {
    console.log(`Downloading Chromium ${preferredRevision}`);
    revisionInfo = await browserFetcher.download(preferredRevision);
  }
  return puppeteer.launch({
    executablePath: revisionInfo.executablePath
  });
}