Skip to main content
The screenshot command captures images of application windows.

Overview

Arguments

string
required
Application name or bundle identifier
string
Output file path (defaults to auto-generated temp file)

Options

boolean
Output as JSON with path and dimensions

Examples

Basic screenshot

Output:

Specify output path

Output:

JSON output

Output:

Capture with tilde expansion

Behavior

Window selection

The command captures the frontmost window of the specified application.
If an app has multiple windows, only the active/front window is captured.

Image format

Screenshots are always saved as PNG files with the following characteristics:
  • Format: PNG (Portable Network Graphics)
  • Resolution: Native display resolution (Retina/HiDPI aware)
  • Quality: Lossless compression
  • Transparency: Preserved if window has transparent areas

File path handling

When no path is specified:
Files are created in the system temp directory with unique names:

Overwriting files

If the output file already exists, it will be overwritten without warning.

Use cases

Visual testing

Documentation generation

Bug reports

Progress monitoring

Automated tutorials

Regression testing

Advanced patterns

Screenshot on error

Timestamped series

Conditional screenshots

Integration with other tools

Image processing (ImageMagick)

Comparison tools

Upload to services

Tips

For consistent screenshots, ensure the application window is fully visible and not obscured by other windows.
Add small delays (100-500ms) before screenshots to ensure UI has fully updated after actions.
Use descriptive filenames with timestamps for easier organization and debugging.
Screenshots capture only the frontmost window. If you need multiple windows, activate each one before capturing.
The command requires the app to have at least one window. Headless or background apps without windows will fail.
  • wait - Wait for UI state before capturing
  • snapshot - Get element structure before screenshot
  • get title - Verify window title before capture
  • click - Navigate to desired state