Skip to main content
Version: 24.38.0

Tracing 类

🌐 Tracing class

Tracing 类公开跟踪审计接口。

🌐 The Tracing class exposes the tracing audit interface.

语法

🌐 Signature

export declare class Tracing

附注

🌐 Remarks

你可以使用 tracing.starttracing.stop 创建一个 trace 文件,该文件可以在 Chrome 开发者工具或 timeline viewer 中打开。

🌐 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

方法

🌐 Method

修饰符

🌐 Modifiers

描述

🌐 Description

start(options)

启动当前页面的跟踪。

🌐 Starts a trace for the current page.

附注

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

🌐 Only one trace can be active at a time per browser.

stop()

停止使用 start 方法启动的跟踪。

🌐 Stops a trace started with the start method.