Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Playwright MCP snapshots are structured, text-based views of a web page’s accessibility tree. In an MCP client, use browser_snapshot to capture one (or use the snapshot returned by most interaction tools), take the current node ref for an action, and capture again after the page changes. Use browser_find to locate text in a large snapshot. Add a screenshot when layout, charts, canvas content, or imagery carries information that the accessibility tree cannot represent.

What a Playwright MCP snapshot contains

A snapshot describes the page through accessibility semantics rather than pixels. Typical output includes roles such as heading, textbox, list, listitem, checkbox, link, and contentinfo, together with accessible names and visible text. Exposed nodes receive references such as e5. Those references are targets for actions such as typing and clicking; they are not coordinates and do not imply that every visual object is represented.

Read the current snapshot as a tree. A heading tells you the section structure, a textbox usually includes its label, and a checkbox includes its accessible name and state. This makes snapshots useful for finding semantic controls and page content while using far fewer tokens than sending an image to a vision model. Playwright’s documentation describes them as text-only, precise for ref targeting, fast to parse, and deterministic when the structure is unchanged; those are qualitative product descriptions, not an independent benchmark. Read the official snapshots reference.

Prerequisites and MCP setup

The current Playwright getting-started guide lists Node.js 20 or newer and an MCP-capable client as prerequisites. Client configuration locations differ, so follow your client’s current instructions when registering the server. The documented package name is @playwright/mcp@latest; because the latest tag and client integrations can change, verify the guide before deployment. See Playwright’s MCP setup guide.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Register the server in an MCP client

  1. Install or verify Node.js 20 or newer.
  2. Open your MCP client’s server configuration and add a server that runs npx @playwright/mcp@latest, using the JSON or UI format required by that client.
  3. Restart or reload the client, then ask the connected assistant to open a URL or navigate to a page.
  4. Use the snapshot returned by the navigation or interaction tool, or request an explicit snapshot when you want a deliberate inspection point.

Run a standalone HTTP server

For clients that connect over HTTP, the getting-started guide demonstrates:

npx @playwright/mcp@latest --port 8931

Configure the client to connect to the server’s /mcp endpoint. Keep the endpoint and startup flags aligned with the current guide, since server options are version-sensitive.

Capture a snapshot deliberately

Call browser_snapshot after navigation or whenever you need a known inspection state. The documented options let you control the amount and form of output:

Option Use
target Return only a selected subtree instead of the whole page.
depth Limit traversal depth to keep output manageable.
boxes Add viewport-relative CSS-pixel bounding rectangles.
filename Save the snapshot to a file.

Most tools that interact with a page attach a fresh snapshot to their response. An explicit call is most useful before planning several actions, after a state transition, or when narrowing a very large page.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Global snapshot settings

The server supports settings that affect automatic snapshots. --snapshot-mode=none prevents tools from attaching snapshots to responses, while --snapshot-boxes adds bounding boxes. The project also documents environment variables and snapshot modes including full and none. Check the current reference and repository before relying on a flag in automation. Project repository and current options.

Use refs safely for actions

  1. Capture or read the newest snapshot.
  2. Identify the node’s current ref, such as e5 for a textbox or e10 for a button.
  3. Pass that ref to the appropriate typing, clicking, checking, or selection tool.
  4. Read the newly returned state and use refs from that response for the next action.

Refs are unique within one snapshot and remain useful only while that page state is current. Navigation, opening a dialog, submitting a form, or any other change can invalidate them. A selector or locator string may also be accepted by an action, but the snapshots guide recommends refs as the normal choice because they identify the node represented in the current tree.

Todo-style interaction pattern

For a TodoMVC-style page, first ask the client to open the app and inspect the returned snapshot. Find the labeled textbox ref, type a task, then use the snapshot returned after typing to locate the current button or list state. Do not carry the original refs forward automatically: each page change is an opportunity to recapture and reselect. The official introduction demonstrates this flow. Playwright MCP introduction.

Find content in a large snapshot

Use browser_find when scanning the entire tree is unnecessary. Provide either a plain-text substring or a regular expression, not both. Plain-text matching is case-insensitive. Regular expressions are case-sensitive by default, with flags available according to the tool’s documentation. Results include matching nodes and a small amount of surrounding tree-path context, so you can select a ref without reviewing every line.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Examples

  • Search for Billing address to locate a labeled field.
  • Search for Submit to find candidate buttons or links.
  • Use a regular expression such as ^Orders+# when labels follow a known pattern.

If the result is still broad, request a subtree with target or reduce traversal with depth. These controls reduce context without changing the page.

Why a ref stops working

A missing-ref error normally means the page state changed after the ref was issued. The reliable recovery sequence is:

  1. Stop using the old ref.
  2. Call browser_snapshot again (or use the latest action response).
  3. Select the node’s new ref from that snapshot.
  4. Retry the action.

Do not assume that a visually identical control has the same ref after navigation, filtering, a dialog update, or client-side rendering.

Snapshot versus screenshot

Question Snapshot Screenshot
What it represents Semantic roles, accessible names, and text in the accessibility tree. Rendered pixels and visual appearance.
Targeting Ref-based, exact element targeting. Visual or coordinate-based approximation.
Parsing Text processing with comparatively low token demand. Image/vision processing.
Best fit Labels, form controls, headings, and exposed page text. Layout, charts, canvas, image-heavy regions, and visual defects.

A snapshot cannot describe color relationships, spacing, a chart drawn on a canvas, or an image’s visual details beyond what its accessibility representation exposes. Take a screenshot alongside the snapshot when those details affect the task. If an element is absent from the tree, investigate with visual context or another Playwright method rather than inventing a ref for it. Playwright presents screenshots as complementary to snapshots, not as a replacement.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshooting checklist

The snapshot is too large

  • Use browser_find for the label or text you need.
  • Request a narrower target subtree.
  • Set a smaller depth.

A control is missing

Confirm that the control is exposed in the accessibility tree and that the page has finished rendering. Use a screenshot for visual context, then inspect the page with an appropriate Playwright method; a visual object is not automatically a snapshot node.

Actions target the wrong item

Read the accessible name and surrounding tree path, not just the ref. Search for a more specific label, recapture after any state change, and avoid reusing refs from an earlier response.

Automatic snapshots are absent

Check whether the server was started with --snapshot-mode=none or an equivalent environment setting. Restore the desired mode or call browser_snapshot explicitly.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

When you need an image or PDF rather than an accessibility-tree inspection, ScreenshotNeo provides a one-request website screenshot API. It accepts a URL and returns PNG, JPEG, WebP, or PDF; it can load lazy images, capture a CSS-selected element, emulate devices and dark mode, wait for selectors or network idle, run custom JavaScript or CSS, and more. Before capture it accepts cookie/consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets, with each cleanup step configurable. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use the documented examples (full options are in the ScreenshotNeo API documentation):

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

FAQ

Are snapshots screenshots?

No. They are structured accessibility-tree output. Use a screenshot for visual information.

Can I keep a ref after a page update?

Assume no. Capture a fresh snapshot and choose the new ref after each state-changing action.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Should I always request a full snapshot?

No. Use the full tree for orientation, then browser_find, target, or depth for focused work.

What Node.js version does the current setup guide list?

Node.js 20 or newer, together with an MCP-capable client.

Frequently Asked Questions

Does browser_find search the DOM directly?

It searches the current page snapshot and returns matching nodes with nearby tree-path context.

What should I do when a chart is not useful in the snapshot?

Capture a screenshot as well; canvas and other visual details may not be exposed through the accessibility tree.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The Bottom Line

Use snapshots for semantic, ref-driven page automation; recapture after every state change, narrow large trees with browser_find, and add screenshots when pixels contain essential information.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.