Skip to main content

Overview

Screenshot commands allow you to capture visual snapshots of pages and elements.

screenshot

Capture a screenshot of the page or a specific element.
ParameterDescription
selectorOptional: Element selector to screenshot. If omitted, captures viewport.
pathOptional: File path to save screenshot. If omitted, saves to temp directory.
Options:
OptionDescription
—full, -fCapture full page (scrolls to capture entire page)
—annotateOverlay numbered labels on interactive elements

Basic Screenshots

Examples:
Output:

Annotated Screenshots

Annotated screenshots overlay numbered labels [1], [2], etc. on interactive elements. Each label corresponds to a ref (@e1, @e2) that you can use for interactions. Examples:
Output:
Using Refs from Annotated Screenshots:

Full Page Screenshots

Capture the entire page by scrolling and stitching screenshots together. Examples:

pdf

Generate a PDF of the current page.
ParameterDescription
pathFile path to save PDF
Examples:
Output:

Workflow Examples

Visual Testing

Documentation Generation

Multimodal AI Workflow

Error Reporting

Element Screenshots

Responsive Testing

Image Formats

Screenshots are automatically saved in the format based on file extension:
ExtensionFormat
.pngPNG (default, lossless)
.jpg, .jpegJPEG (lossy, smaller file size)
.webpWebP (modern, efficient)
Examples:

Environment Variables

Control screenshot behavior with environment variables:
VariableDescription
AGENT_BROWSER_ANNOTATEEnable annotated screenshots by default

Best Practices

Wait Before Screenshot

Always wait for page to load before taking screenshots:

Use Full Page for Documentation

Use Annotated for AI Agents

Specify Paths for Organization