Puppeteer performance timeline?

僤鯓⒐⒋嵵緔 提交于 2020-12-11 04:56:59

问题


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

performance timeline


回答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.



来源:https://stackoverflow.com/questions/50660845/puppeteer-performance-timeline

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!