4

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

performance timeline

Everettss
  • 13,024
  • 7
  • 63
  • 89
Atav32
  • 1,488
  • 3
  • 23
  • 30

1 Answers1

4

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.

oligofren
  • 15,352
  • 12
  • 75
  • 134
Everettss
  • 13,024
  • 7
  • 63
  • 89