木偶表演时间表? [英] Puppeteer performance timeline?

查看:78
本文介绍了木偶表演时间表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以记录性能时间表对于使用Puppeteer进行的测试?

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

推荐答案

是的,只需使用

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();
})();

,然后在"Chrome性能"选项卡中加载trace.json文件.如果您想了解更多详细信息,请这是带有章节的文章专门用于分析页面跟踪.

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.

这篇关于木偶表演时间表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆