pub struct Tracing { /* private fields */ }Expand description
Tracing — records Playwright traces for debugging and inspection.
Trace files can be opened in the Playwright Trace Viewer. This is a Chromium-only feature; calling tracing methods on Firefox or WebKit contexts will fail.
Implementations§
Source§impl Tracing
impl Tracing
Sourcepub fn new(
parent: ParentOrConnection,
type_name: String,
guid: Arc<str>,
initializer: Value,
) -> Result<Self>
pub fn new( parent: ParentOrConnection, type_name: String, guid: Arc<str>, initializer: Value, ) -> Result<Self>
Creates a new Tracing from protocol initialization.
Called by the object factory when the server sends a __create__ message.
Sourcepub async fn start(&self, options: Option<TracingStartOptions>) -> Result<()>
pub async fn start(&self, options: Option<TracingStartOptions>) -> Result<()>
Start tracing.
Playwright implements tracing as a two-step process: tracingStart to
configure the trace, then tracingStartChunk to begin recording.
§Arguments
options- Optional trace configuration (name, screenshots, snapshots)
§Errors
Returns error if:
- Tracing is already active
- Communication with browser process fails
See: https://playwright.dev/docs/api/class-tracing#tracing-start
Sourcepub async fn stop(&self, options: Option<TracingStopOptions>) -> Result<()>
pub async fn stop(&self, options: Option<TracingStopOptions>) -> Result<()>
Stop tracing.
Playwright implements stopping as a two-step process: tracingStopChunk
to finalize the recording, then tracingStop to tear down.
If options.path is provided, the trace is exported to that file as a
.zip archive. If no path is provided, the trace is discarded.
§Arguments
options- Optional stop options; setpathto save the trace to a file
§Errors
Returns error if:
- Tracing was not active
- Communication with browser process fails
See: https://playwright.dev/docs/api/class-tracing#tracing-stop