Core concepts
Logging and debugging
Four places Browser tells you what happened — log.html, the Playwright log, traces and coverage.
Browser writes to more than one place, because it is more than one process. Knowing which file answers which question saves a lot of guessing.
| Where | What it holds | When to open it |
|---|---|---|
log.html
Most Browser keywords log a message produced by the Node side — often including the selector and the value used. More of them appear at DEBUG level.
When a keyword fails, the info level already shows the error from the Playwright call. Running at debug level shows a good deal more:
playwright-log.txt
${OUTPUT_DIR}/playwright-log.txt holds the Node side. It is written by
default, created when the Node process starts, and not written at all if you
import with enable_playwright_debug=disabled.
The Robot log level does not affect it.
The argument takes three values: library (the default — only Browser's own
Node messages), playwright (those plus Playwright's DEBUG=pw:api output), and
disabled (no file at all). False and True are older aliases for the first
two. For much more detail:
Each run replaces the file. If the old one cannot be deleted — still open on
Windows, for instance — the new log is written beside it as
playwright-log-<nanoseconds>.txt.
Traces
A trace records every Playwright call in a context, with a DOM snapshot at each step. It is the single most useful artefact when a test fails somewhere you cannot reproduce.
The zip is written when the context closes — automatically at the
auto-closing level, or when you call Close Context. Do not go looking for it
while the browser is still open.
To record without passing tracing= in every test, set the environment variable
ROBOT_FRAMEWORK_BROWSER_TRACING=True. It applies to every New Context and
New Persistent Context — a context that New Page creates implicitly is not
traced, so a suite that never calls New Context records nothing. And
auto_delete_passed_tracing=True at import keeps only the traces of failed
tests, which is what makes this affordable in CI:
Open the result either way:
or drop it on trace.playwright.dev, which runs entirely in your browser.
Coverage
Browser can collect code coverage from the pages it drives — data from Playwright, report from monocart-coverage-reports.
Coverage is enabled per page:
Combine the per-page data into one report:
Combining needs the raw data, which is why Start Coverage above passes
raw=True. Note that raw is ignored when you also pass config_file — then
you have to add ['raw'] to reports in the config yourself — without it there is nothing to merge and the command fails with
No raw reports found. The same thing is available as the
Merge Coverage Reports keyword.
Monocart takes a config file if you need filtering, which you probably will — third-party bundles otherwise dominate the numbers.