Skip to main content

Trace viewer

Playwright Trace Viewer is a GUI tool that helps you explore recorded Playwright traces after the script has ran. You can open traces locally or in your browser on

Viewing the trace

You can open the saved trace using Playwright CLI or in your browser on

mvn exec:java -e -D -D exec.args="show-trace"


Once trace is opened, you will see the list of actions Playwright performed on the left hand side:

Trace Viewer Actions Tab

Selecting each action reveals:

  • action snapshots,
  • action log,
  • source code location,
  • network log for this action

In the properties pane you will also see rendered DOM snapshots associated with each action.


See metadata such as the time the action was performed, what browser engine was used, what the viewport was and if it was mobile and how many pages, actions and events were recorded.

Trace Viewer Metadata Tab


When tracing with the screenshots option turned on, each trace records a screencast and renders it as a film strip:

Playwright Trace viewer > Film strip

You can hover over the film strip to see a magnified image of for each action and state which helps you easily find the action you want to inspect.

Playwright Trace viewer magnify


When tracing with the snapshots option turned on, Playwright captures a set of complete DOM snapshots for each action. Depending on the type of the action, it will capture:

BeforeA snapshot at the time action is called.
ActionA snapshot at the moment of the performed input. This type of snapshot is especially useful when exploring where exactly Playwright clicked.
AfterA snapshot after the action.

Here is what the typical Action snapshot looks like:

Playwright Trace Viewer > Snapshots

Notice how it highlights both, the DOM Node as well as the exact click position.


See what action was called, the time and duration as well as parameters, return value and log.

Trace Viewer Call Tab


See the console output for the action where you can see console logs or errors.

Trace Viewer Console Tab


See any network requests that were made during the action.

Trace Viewer Network Tab


See the source code for your entire test.

Trace Viewer Source Tab

Recording a trace

Traces can be recorded using the BrowserContext.tracing() API as follows:

Browser browser = browserType.launch();
BrowserContext context = browser.newContext();

// Start tracing before creating / navigating a page.
context.tracing().start(new Tracing.StartOptions()

Page page = context.newPage();

// Stop tracing and export it into a zip archive.
context.tracing().stop(new Tracing.StopOptions()

This will record the trace and place it into the file named

Viewing the trace

You can open the saved trace using Playwright CLI or in your browser on

mvn exec:java -e -D -D exec.args="show-trace"

Using is a statically hosted variant of the Trace Viewer. You can upload trace files using drag and drop.

Drop Playwright Trace to load

Viewing remote traces

You can open remote traces using it's URL. They could be generated on a CI run which makes it easy to view the remote trace without having to manually download the file.

mvn exec:java -e -D -D exec.args="show-trace"

You can also pass the URL of your uploaded trace (e.g. inside your CI) from some accessible storage as a parameter. CORS (Cross-Origin Resource Sharing) rules might apply.