GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Playwright for Java
  • Docs
  • API
  • Java
  • Node.js
  • Python
  • .NET
  • Community
  • Writing tests
  • Generating tests
  • Running and debugging tests
  • Setting up CI
  • Test Runners
  • JUnit (experimental)

This view

  • Original page
  • New address

GeezerVison is showing playwright.dev — Trace viewer | Playwright Java

This is unreleased documentation for Playwright Java Next version.
For up-to-date documentation, see the latest version (stable).
Version: Next

Introduction​

Playwright Trace Viewer is a GUI tool that lets you explore recorded Playwright traces of your tests meaning you can go back and forward though each action of your test and visually see what was happening during each action.

You will learn

  • How to record a trace
  • How to open the trace viewer

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()
.setScreenshots(true)
.setSnapshots(true)
.setSources(true));

Page page = context.newPage();
page.navigate("https://playwright.dev");

// Stop tracing and export it into a zip archive.
context.tracing().stop(new Tracing.StopOptions()
.setPath(Paths.get("trace.zip")));

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

Opening the trace​

You can open the saved trace using the Playwright CLI or in your browser on trace.playwright.dev. Make sure to add the full path to where your trace's zip file is located. Once opened you can click on each action or use the timeline to see the state of the page before and after each action. You can also inspect the log, source and network during each step of the test. The trace viewer creates a DOM snapshot so you can fully interact with it, open devtools etc.

mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="show-trace trace.zip"
playwright trace viewer

To learn more check out our detailed guide on Trace Viewer.

What's next​

  • Run tests on CI with GitHub Actions
  • Learn more about Trace Viewer
  • Introduction
  • Recording a trace
  • Opening the trace
  • What's next
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.