
Why the cheapest correct browser representation isn't always a screenshot, or a snapshot.
In short: On a simple page, an accessibility snapshot costs a fraction of a screenshot. On a data-heavy app page, the full snapshot cost more, up to 7.6 times as much in my measurements. A one-line browser query beat both. Decide what question the model has to answer, then send the smallest representation that contains the answer.
I thought I had solved this
A couple of months ago I drafted a post arguing that most of my UI validation didn't need vision. On a personal project I was sending a screenshot to a vision model on every edit–verify check, but most checks were structural: "Is the heading still there?" "Is this button reachable?" The browser already describes the page to assistive technology as an accessibility tree. agent-browser prints it with snapshot, labelling each element with a ref that later commands can act on. Here is part of one from the dashboard I tested later, with placeholder names:
- navigation "Conversations" [ref=e3]
- heading "Live conversations" [level=2, ref=e6]
- textbox "Search conversations" [ref=e10]
- region "Waiting" [ref=e29]
- link "Visitor A · Company A, Waiting for a person · 19m, …" [ref=e35]
- button "Take over" [ref=e36]
On that site a snapshot was a few hundred tokens and a screenshot was about 1,400. So: send the snapshot and save context.
Before publishing, I re-tested on an internal dashboard from work. On a simple page the claim held. On the dashboard, the full snapshot was larger than the screenshot on every view, and each representation missed different questions in different ways. The lesson wasn't "use snapshots instead of screenshots". It was use the cheapest representation that still contains the answer.
What the dashboard showed
On 1 October 2026 I measured 11 views of the dashboard, running on fixture data, plus a simple public demo page. Each page was captured as a 1366×768 screenshot, as HTML, and as three snapshots from agent-browser 0.38.1: full, compact (-c) and interactive-only (-i).

All counts are Claude tokens from Anthropic's token-counting API, with Claude Sonnet 5.5; Opus 5.5 gave identical counts. Screenshots were counted as images. Other providers count image tokens differently.
- On the simple page, snapshots won. The full snapshot was 44% smaller than the screenshot and
-iwas 77% smaller. - On the dashboard, the full snapshot always lost, by a median of 2.9 times. A screenshot costs the same whatever the page holds. A snapshot grows with the page.
-icame out about even: a median of 1,335 tokens against the screenshot's 1,375, smaller on 6 of 11 views.- HTML depends on the page.
<body>HTML beat the full snapshot on the simple page but was a median 20,514 on the dashboard. My captures came from a Vite dev server, which inlines CSS, so 73–92% of the raw HTML, mostly CSS, sat in<head>. - Count with the model's own tokenizer. My first pass used OpenAI's
o200k_baseas a stand-in. Claude counted the same text 1.33–1.57 times higher, which flipped three views from "snapshot cheaper" to "screenshot cheaper".
Why snapshots grow, and what each one missed
I had treated an accessibility snapshot as a cheaper version of a screenshot. It isn't. It is another representation of page state, and on a data-heavy page it contains far more than most questions need.
Part of the size is how component UIs build text. One heading becomes several nodes, and the snapshot prints each one:
- heading "Waiting · 1" [level=3, ref=e32]
- StaticText "Waiting"
- StaticText "· "
- StaticText "1"
The heading's name already says "Waiting · 1". Across the 11 views, StaticText lines made up a median 41% of a full snapshot's tokens, and 72% on the conversation list. -c keeps them. -i drops them, which is why it is so much smaller.
Size was only half the question. The other half was whether a model could still answer from the smaller representation.
Did the answers hold up?
I wrote 18 questions about three of the pages: the live queue, model settings and analytics. Fifteen were about content and structure; three needed the eye (an overlapping tip, a row's colour, a half-hidden field). I took the correct answers from the DOM. Three separate Claude Sonnet 5.5 sessions each answered all 18, each seeing only one representation and told to say "cannot tell" rather than guess. It used the same day's 0.33.1 captures, which differ only in whitespace.

The scores matter less than how each one missed:

- The screenshot was wrong twice, and sure both times. It said the hover-only "Take over" button wasn't there, and read a half-hidden placeholder as "Default: 30" when the page says 20. It also missed a flagged conversation below the list's fold and a setting further down the page.
- The full snapshot was never wrong. Where it lacked the information (colour, overlap, placeholder text) it said "cannot tell".
-idropped what a reader needs. It keeps elements with refs but drops loose text such as tags, badges and headline totals. Its one wrong answer summed the chart's daily values to 98 where the headline it couldn't see says 80, a gap that traces to my inconsistent test data.
One run of 18 questions is a direction, not a benchmark. But confident wrong answers are harder to catch in an agent loop.
Targeted queries beat both
Most checks in an edit–verify loop ask one thing. Asking that one thing directly is cheaper than any whole-page representation:
# Is the "Take over" button still there?
agent-browser find role button text --name "Take over" # -> Take over
# Does the queue pane hide rows below its fold?
agent-browser eval "(() => { const q = document.querySelector('.queue-list');
return { content: q.scrollHeight, visible: q.clientHeight }; })()"
# -> { "content": 774, "visible": 568 }
# Where is it?
agent-browser get box ".queue-list" # -> x: 68, y: 188, width: 320, height: 568Each of these answers is 3–25 tokens. If every check in a 40-check session sent the median view, the totals would be roughly:

At current input prices none of these is a large bill. The cost that matters is context: in a loop that keeps every observation, whole-page captures can crowd out the code the agent is supposed to be editing.
The --delta row uses snapshot --delta (agent-browser 0.38 and later): the full tree once, then only what changed, which cost 10 tokens when nothing did and 138–161 for a small edit. screenshot --if-changed does the same for images. The agent has to apply each delta to the tree it holds, and watch -i: a one-word heading change costs 599 tokens here, because the dashboard's clickable root element is named with the whole page's text.
If the browser can give you a number, don't estimate it
- Overflow. In this app the page never scrolls; its panes do, so check the pane. The second command above shows the queue holds 774px of rows in 568px. The three conversations below that fold were missing from the screenshot, even with screenshot
--full, and present in the snapshot. - Overlap. Sampling
document.elementFromPointacross the list caught a first-run tip floating over it. The screenshot reader spotted it too; the snapshot readers couldn't. - Contrast. I computed the WCAG contrast ratio for every text and background pair on six views, in both themes. All passed, the lowest at 4.66:1 against a 4.5:1 minimum, a number a vision model is unlikely to produce. My first script reported five failures, all bugs in my script rather than the design, so test a check against a known failure before you trust a clean pass.
Cheap checks need checking too
- Wait for content, not the network. The dashboard holds a live connection open, so the network never went idle, and three of my first captures were snapshots of a loading spinner. Wait until no loading indicator remains and the DOM stops changing.
- Take a new snapshot after every change. A ref such as
@e36can point at the wrong element once the page has changed. - Test selectors against an element you know exists.
:has-text()is a Playwright extension. agent-browser returned 0, with exit status 0, for a heading that was on the page, exactly like a real "no". - Prefer exact or role locators. A loose
find text "Take over"matched a comment in a dev stylesheet and printed 205 KB of CSS. - Check scoped output. Scoping a snapshot to
mainwith-smade the analytics view's full snapshot nearly three times longer, because parts of the tree repeated. - Ask only for the styles you need.
get styleson one element cost 7,253 tokens. Reading two properties withgetComputedStyleinevalcost about 20.
The rule: cheapest correct representation
The cheapest representation is often none. A check that has to keep working belongs in a committed test, which runs on every change and uses no model context. For everything else, the order I use now:

The screenshot row matters most after an edit: a query only answers what you thought to ask, and the regressions that hurt are often the ones you didn't. A few cautions go with it. On cost, the interactive snapshot and a screenshot are close: on the three answer-test pages the screenshot was cheaper. -i is a poor source of page text, because it drops loose labels, badges and totals. A screenshot can't show hover-only controls or content below a pane's fold. And set its scale on purpose: my Retina display captured at 2× by default, at more than three times the tokens.
Other tools make the same trade-off. On the same 11 views, Playwright's page.ariaSnapshot() was a median of 2,290 tokens, including page text the interactive snapshot leaves out. Its AI mode, which adds refs, link URLs and cursor hints, was 6,830, the largest snapshot format I measured. The question to ask of each tool stays the same: how much of what it sends does this check actually need?
Put it in your agent's instructions
A coding agent follows this only if it's told to. Add a section like this to your repo's AGENTS.md, then add your own dev server URL and loading indicator underneath:
## Browser checks
If it must keep working, write or extend a committed test; it uses no context.
Otherwise send the smallest thing that answers the check:
- One fact: a targeted query (`find`, `get box`, `eval`), not a snapshot.
- To act: `snapshot -i`; re-snapshot after any change.
- After an edit: one screenshot at 1x (`set viewport 1366 768`).
- Structure or text: a full `snapshot`. Use `--delta` in loops.
- Wait for the page to settle, not the network; test selectors on a known element.The takeaway
In an earlier post, I explained why we're moving heavy LLM payloads to TOON, a more compact format for structured data. The same principle applies to browser state. Before you change the model, look at the representation you give it.
These are numbers from one project on one day. Your pages, tokenizer and tool versions will give different ones, so measure before you choose a representation.
The question never changed. The cheapest correct answer to it did.
