v1.12.0
🧟♂️ Introducing Playwright Trace & TraceViewer
Playwright Trace Viewer is a new GUI tool that helps exploring recorded Playwright traces after the script ran. Playwright traces let you examine:
- page DOM before and after each Playwright action
- page rendering before and after each Playwright action
- browser network during script execution
Traces are recorded using the new BrowserContext.tracing()
API:
Browser browser = chromium.launch();
BrowserContext context = Browser.newContext();
// Start tracing before creating / navigating a page.
context.tracing.start(new Tracing.StartOptions()
.setScreenshots(true)
.setSnapshots(true);
Page page = context.newPage();
page.goto("https://playwright.dev");
// Stop tracing and export it into a zip archive.
context.tracing.stop(new Tracing.StopOptions()
.setPath(Paths.get("trace.zip")));
Traces are examined later with the Playwright CLI:
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="show-trace trace.zip"
That will open the following GUI:
👉 Read more in trace viewer documentation.
Browser Versions
- Chromium 93.0.4530.0
- Mozilla Firefox 89.0
- WebKit 14.2
This version of Playwright was also tested against the following stable channels:
- Google Chrome 91
- Microsoft Edge 91
New APIs
reducedMotion
option inPage.emulateMedia()
,BrowserType.launchPersistentContext()
,Browser.newContext()
andBrowser.newPage()
BrowserContext.onRequest()
BrowserContext.onRequestFailed()
BrowserContext.onRequestFinished()
BrowserContext.onResponse()
tracesDir
option inBrowserType.launch()
andBrowserType.launchPersistentContext()
- new
BrowserContext.tracing()
API namespace - new
Download.page()
method