Skip to main content

Screenshots & PDF

Screenshots

CommandDescription
screenshotScreenshot of the viewport
screenshot [ref]Screenshot of a specific element
screenshot --filename=fSave with custom filename
screenshot --full-pageFull scrollable page
$ playwright-cli screenshot
# Screenshot saved to .playwright-cli/screenshot-2026-03-15.png

$ playwright-cli screenshot e15
# Screenshot of element e15

$ playwright-cli screenshot --filename=login-page.png
$ playwright-cli screenshot --full-page --filename=full-page.png

PDF export

playwright-cli pdf                      # save with auto-generated name
playwright-cli pdf --filename=page.pdf # save with custom name

When to use screenshots

Screenshots complement accessibility snapshots:

Use caseBest tool
Interacting with elementsAccessibility snapshot (refs)
Verifying visual layoutScreenshot
Canvas/chart contentScreenshot
Documenting a bugScreenshot
Understanding page structureAccessibility snapshot
Reading text contentAccessibility snapshot

Snapshots

For accessibility tree output (not a visual capture):

playwright-cli snapshot                 # full page snapshot
playwright-cli snapshot --filename=f # custom filename
playwright-cli snapshot [ref] # element snapshot
playwright-cli snapshot --depth=N # limit depth

See Snapshots for details on the format and usage.