Skip to content

snapshot

Capture screenshot + DOM tree + page state + storage in one shot.

Bridge Required

This command requires an active bridge connection and platform screenshot tools.

Usage

tauri-agent-tools snapshot -o <prefix> [options]

Options

Option Description Default
-o, --output <prefix> Output path prefix (e.g. /tmp/debug) (required)
-s, --selector <css> CSS selector to screenshot (full window if omitted)
-t, --title <regex> Window title to match auto-discover
--dom-depth <number> DOM tree depth 3
--eval <js> Additional JS to eval and save
--json Output structured manifest
--port <number> Bridge port (auto-discover if omitted)
--token <string> Bridge token (auto-discover if omitted)

Output Files

Given -o /tmp/debug, the command writes:

File Contents
/tmp/debug-screenshot.png Full window or element screenshot
/tmp/debug-dom.json DOM tree serialized to depth
/tmp/debug-page-state.json URL, title, viewport, scroll position, Tauri detection
/tmp/debug-storage.json localStorage and sessionStorage contents
/tmp/debug-eval.json Custom eval result (only if --eval is provided)

Examples

Quick debug dump

tauri-agent-tools snapshot -o /tmp/debug
screenshot: /tmp/debug-screenshot.png
dom: /tmp/debug-dom.json
pageState: /tmp/debug-page-state.json
storage: /tmp/debug-storage.json

Screenshot a specific element

tauri-agent-tools snapshot -o /tmp/toolbar -s ".toolbar"

Include custom data

tauri-agent-tools snapshot -o /tmp/state --eval "JSON.stringify(window.__APP_STATE__)"

JSON manifest for automation

tauri-agent-tools snapshot -o /tmp/snap --json
{
  "screenshot": "/tmp/snap-screenshot.png",
  "dom": "/tmp/snap-dom.json",
  "pageState": "/tmp/snap-page-state.json",
  "storage": "/tmp/snap-storage.json"
}

Error Handling

Each sub-step (screenshot, DOM, page state, storage, eval) is independent. If one fails, the others still run. Failed steps report an error string instead of a file path:

{
  "screenshot": "/tmp/snap-screenshot.png",
  "dom": "error: Bridge error (500): Internal error",
  "pageState": "/tmp/snap-page-state.json",
  "storage": "/tmp/snap-storage.json"
}