BROWSER

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.

WhereWhat it holdsWhen to open it
log.htmlThe Python side: keywords, arguments, statusFirst. Always.
playwright-log.txtThe Node side of the libraryA keyword failed and log.html does not say why
browser/traces/trace_*.zipEvery Playwright call, with DOM snapshotsSomething failed and you need to see the page as it was
Coverage reportWhich code the run actually exercisedAsking what the suite does not touch

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:

robot --loglevel debug --outputdir output tests/

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:

*** Settings ***Library    Browser    enable_playwright_debug=playwright

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.

New Context    tracing=True

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:

ROBOT_FRAMEWORK_BROWSER_TRACING=True robot --outputdir output tests/

Open the result either way:

rfbrowser show-trace output/browser/traces/trace_context=<id>.zip

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:

*** Test Cases ***Checkout Coverage    New Page    https://example.com/checkout    Start Coverage    raw=True    Take Screenshot    Stop Coverage

Combine the per-page data into one report:

rfbrowser coverage output/browser/coverage/ output/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.