Puppeteer 追踪

2020-06-29 14:03 更新

class:tracing

class: Tracing v0.9.0 你可以使用 tracing.start 和 tracing.stop 创建一个可以在 Chrome DevTools or timeline viewer 中打开的跟踪文件。

await page.tracing.start({path: 'trace.json'});
await page.goto('https://www.google.com');
await page.tracing.stop();

Methods

tracing.start(options)v0.9.0 tracing.stop()v0.9.0

Methods

tracing.start(options)v0.9.0

  • options <Object>
    • path <string> 跟踪文件写入的路径
    • screenshots <boolean> 捕获跟踪中的屏幕截图
    • categories <Array<string>> 指定要使用的自定义类别替换默认值 returns: <Promise> 每个浏览器一次只能激活一条跟踪。

  • returns: <Promise<Buffer>> Promise which resolves to buffer with trace data.
以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号