Skip to content Skip to sidebar Skip to footer

Puppeteer Performance Timeline?

Is there a way to record a performance timeline for tests run with Puppeteer?

Solution 1:

Yes, just use page.tracing methods like in this example:

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();

  await page.tracing.start({ path: 'trace.json' });
  await page.goto('https://en.wikipedia.org');
  await page.tracing.stop();

  await browser.close();
})();

And then load trace.json file in Chrome Performance tab. If you want more details here is an article with a chapter dedicated to analyzing page tracing.

Post a Comment for "Puppeteer Performance Timeline?"