🧟♂️ 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
- browse network during script execution
Traces are recorded using the new browser_context.tracing
API:
browser = chromium.launch()
context = browser.new_context()
# Start tracing before creating / navigating a page.
context.tracing.start(screenshots=True, snapshots=True)
page.goto("https://playwright.dev")
# Stop tracing and export it into a zip archive.
context.tracing.stop(path = "trace.zip")
Traces are examined later with the Playwright CLI:
playwright 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
reduced_motion
option inpage.emulate_media()
,browser_type.launch_persistent_context()
,browser.new_context()
andbrowser.new_page()
browser_context.on("request")
browser_context.on("requestfailed")
browser_context.on("requestfinished")
browser_context.on("response")
traces_dir
option inbrowser_type.launch()
andbrowser_type.launch_persistent_context()
- new
browser_context.tracing
API namespace - new
download.page
getter