Skip to content

Feature request: Enhanced snapshot options #398

@yinhx3

Description

@yinhx3

Background

agent-browser provides a set of snapshot utilities purpose-built for AI coding agents. playwright-cli already has a strong foundation: YAML-based snapshots, --depth, --boxes, selector scoping, and the e1 [textbox "Email"] ref format. A few capabilities from agent-browser could be adopted to make playwright-cli snapshots even more agent-friendly.

Suggested Features

Like agent-browser's snapshot options, playwright-cli could offer similar flags to make snapshots leaner and more agent-friendly. For example:

--interactive / -i

Filter the snapshot to only include interactive elements (buttons, links, inputs, selects, textareas, etc.), dramatically reducing token consumption.

playwright-cli snapshot --interactive
### Page
- Page URL: https://example.com/
- Page Title: Example Domain
### Snapshot
- e2 [button] "Submit"
- e3 [textbox "Email"]
- e4 [link] "Learn more"

--compact / -c

Strip empty or semantically meaningless structural elements (e.g. empty <div> and <span> containers) from the snapshot.

playwright-cli snapshot --compact

Why this matters

These capabilities directly determine how efficiently an AI agent can understand and operate on a page — with minimal tokens and maximum speed. playwright-cli's snapshot is already excellent; these options would cover even more real-world agent workflows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions