Diagnostics¶
Two tools for capturing what happened during a run: screenshots and traces.
Screenshots¶
Page.screenshot returns the image bytes as a Buf. Pass :path to also write
the image to disk.
1 2 3 4 5 | |
The bytes are a PNG, so they begin with the PNG signature
(137, 80, 78, 71).
Tracing¶
Tracing records screenshots and DOM snapshots for the lifetime of a context, then writes them to a zip that the Playwright trace viewer can open. This is what the BDD::Behave glue uses to dump a trace when an example fails.
Start tracing on the context before driving it, then stop and write the zip.
1 2 3 4 5 6 7 8 | |
Open the result with the Playwright CLI:
1 | |