Is there a way to record a performance timeline for tests run with Puppeteer?
Asked
Active
Viewed 1,263 times
1 Answers
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.
-
Is there a way to generate a report from this JSON file(trace.json), as it contain lots of telemetry data? – Jyoti Prakash Mallick Sep 17 '20 at 09:45