playwright-rs-trace
Programmatic parser for Playwright trace zip files (format v8, matching Playwright 1.59.x).
The Playwright JS ecosystem ships a trace-viewer UI but no documented parsing API. This crate fills that gap for Rust:
use ;
let mut reader = open?;
println!;
for action in reader.actions
The reader is a streaming iterator — events / actions are yielded lazily as the underlying zip stream is read, so a large trace doesn't need to fit in memory before processing begins. This is the property the future browser-hosted WASM trace viewer (issue #82) needs to render partial traces.
Forward compatibility
The parser is conservative about what it knows. Every event is preserved
losslessly via TraceReader::raw_events(); only the events() and
actions() paths attempt typed deserialization. Event kinds we don't
model (or known kinds whose payload schema changes in a future
Playwright minor version) surface as
TraceEvent::Unknown(RawEvent) — never silently dropped.
If you need to handle a kind we haven't modelled yet, dispatch on
RawEvent::kind() and read as_value() for
the full JSON.
Status
Pre-1.0. Today: open a trace zip, stream events, reassemble actions,
parse network entries. See the crate CHANGELOG for
what's shipped; the project's
docs/implementation-plans/trace.md
tracks the longer roadmap (snapshots, resource loader, action tree,
query helpers, WASM compatibility, console + screencast).
Test fixtures
The integration tests parse a checked-in tests/fixtures/basic.trace.zip.
Regenerate when the trace format or fixture content changes:
See tests/fixtures/README.md for details.
License
Apache-2.0. See LICENSE (workspace root).