Skills for cmux terminal integration: browser automation for visual verification, debug windows, markdown viewer, and core topology control. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1.8 KiB
1.8 KiB
Snapshot and Refs
Element refs from snapshots make browser automation compact and reliable.
Related: commands.md, SKILL.md
Contents
How Refs Work
Classic flow:
full DOM/HTML -> selector guessing -> action
cmux flow:
snapshot -> refs (e1/e2/...) -> direct action
The Snapshot Command
cmux browser surface:7 snapshot
cmux browser surface:7 snapshot --interactive
cmux browser surface:7 snapshot --interactive --compact --max-depth 3
Using Refs
cmux browser surface:7 click e6
cmux browser surface:7 fill e10 "user@example.com"
cmux browser surface:7 fill e11 "password123"
cmux browser surface:7 click e12
Ref Lifecycle
Refs are invalidated when page structure changes.
cmux browser surface:7 snapshot --interactive
# e1 is "Next"
cmux browser surface:7 click e1
# page changed, take a fresh snapshot
cmux browser surface:7 snapshot --interactive
Best Practices
- Snapshot before interacting.
- Re-snapshot after navigation/modal/open-close flows.
- Use
--snapshot-afteron mutating actions. - Scope snapshots with
--selectorfor very large pages.
Troubleshooting
not_found / stale ref
cmux browser surface:7 snapshot --interactive
Element missing due visibility/timing
cmux browser surface:7 wait --selector "#target" --timeout-ms 10000
cmux browser surface:7 scroll --dy 400
cmux browser surface:7 snapshot --interactive
Too many elements
cmux browser surface:7 snapshot --selector "form#checkout" --interactive