Skip to content

Add dedicated screenshot subcommand for page captures #31

Description

@cschanhniem

Feature Request

The current CDP escape hatch (browser-control cdp Page.captureScreenshot) works but requires the user to know CDP internals and manually handle Base64 decoding, format selection, and file I/O.

A dedicated screenshot subcommand would make this common operation a first-class citizen.

Proposed API

# Full-page screenshot, auto-detect format from extension
browser-control screenshot page.png

# Set format and quality explicitly
browser-control screenshot --format jpeg --quality 80 page.jpg

# Capture a specific region (x, y, width, height)
browser-control screenshot --clip 100,50,800,600 region.png

# Write Base64 to stdout (for piping back to agent context)
browser-control screenshot --stdout > screenshot.b64

Rationale

Coding agents frequently need to capture page state for visual context — for example after a click or fill to confirm the result. A dedicated command would:

  1. Handle Base64 decoding and file writing internally
  2. Support --format png|jpeg|webp with quality control
  3. Support --clip for region captures (useful for isolating UI elements)
  4. Support --fullpage via Page.captureFullScreenshot for tall pages
  5. Optionally write Base64 to stdout for agent tool-use workflows without temp files

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions