Skip to main content
Version: 22.9.0

Tracing 类

¥Tracing class

Tracing 类公开跟踪审计接口。

¥The Tracing class exposes the tracing audit interface.

签名:

¥Signature:

export declare class Tracing

备注

¥Remarks

你可以使用 tracing.starttracing.stop 创建可在 Chrome DevTools 或 时间轴查看器 中打开的跟踪文件。

¥You can use tracing.start and tracing.stop to create a trace file which can be opened in Chrome DevTools or timeline viewer.

此类的构造函数被标记为内部构造函数。第三方代码不应直接调用构造函数或创建扩展 Tracing 类的子类。

¥The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the Tracing class.

示例

¥Example

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

方法

¥Methods

方法

修饰符

描述

start(options)

启动当前页面的跟踪。

评论:

每个浏览器一次只能有一个跟踪处于活动状态。

stop()

停止使用 start 方法开始的跟踪。