Document browser navigation verification loop (#974)

* Document browser navigation verification loop

* Add docs regression test for browser navigation guidance

* Remove invalid docs text inspection test
This commit is contained in:
Lawrence Chen 2026-03-05 20:57:18 -08:00 committed by GitHub
parent d4e16ae8c8
commit bb052198e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 21 additions and 12 deletions

View file

@ -10,19 +10,21 @@ Use this skill for browser tasks inside cmux webviews.
## Core Workflow ## Core Workflow
1. Open or target a browser surface. 1. Open or target a browser surface.
2. Snapshot (`--interactive`) to get fresh element refs. 2. Verify navigation with `get url` before waiting or snapshotting.
3. Act with refs (`click`, `fill`, `type`, `select`, `press`). 3. Snapshot (`--interactive`) to get fresh element refs.
4. Wait for state changes. 4. Act with refs (`click`, `fill`, `type`, `select`, `press`).
5. Re-snapshot after DOM/navigation changes. 5. Wait for state changes.
6. Re-snapshot after DOM/navigation changes.
```bash ```bash
cmux browser open https://example.com --json cmux --json browser open https://example.com
# use returned surface ref, for example: surface:7 # use returned surface ref, for example: surface:7
cmux browser surface:7 get url
cmux browser surface:7 wait --load-state complete --timeout-ms 15000
cmux browser surface:7 snapshot --interactive cmux browser surface:7 snapshot --interactive
cmux browser surface:7 fill e1 "hello" cmux browser surface:7 fill e1 "hello"
cmux browser surface:7 click e2 --snapshot-after --json cmux --json browser surface:7 click e2 --snapshot-after
cmux browser surface:7 wait --load-state complete --timeout-ms 15000
cmux browser surface:7 snapshot --interactive cmux browser surface:7 snapshot --interactive
``` ```
@ -58,11 +60,13 @@ cmux browser <surface> wait --function "document.readyState === 'complete'" --ti
### Form Submit ### Form Submit
```bash ```bash
cmux browser open https://example.com/signup --json cmux --json browser open https://example.com/signup
cmux browser surface:7 get url
cmux browser surface:7 wait --load-state complete --timeout-ms 15000
cmux browser surface:7 snapshot --interactive cmux browser surface:7 snapshot --interactive
cmux browser surface:7 fill e1 "Jane Doe" cmux browser surface:7 fill e1 "Jane Doe"
cmux browser surface:7 fill e2 "jane@example.com" cmux browser surface:7 fill e2 "jane@example.com"
cmux browser surface:7 click e3 --snapshot-after --json cmux --json browser surface:7 click e3 --snapshot-after
cmux browser surface:7 wait --url-contains "/welcome" --timeout-ms 15000 cmux browser surface:7 wait --url-contains "/welcome" --timeout-ms 15000
cmux browser surface:7 snapshot --interactive cmux browser surface:7 snapshot --interactive
``` ```
@ -77,13 +81,16 @@ cmux browser surface:7 get value e11 --json
### Stable Agent Loop (Recommended) ### Stable Agent Loop (Recommended)
```bash ```bash
# snapshot -> action -> wait -> snapshot # navigate -> verify -> wait -> snapshot -> action -> snapshot
cmux browser surface:7 snapshot --interactive cmux browser surface:7 get url
cmux browser surface:7 click e5 --snapshot-after --json
cmux browser surface:7 wait --load-state complete --timeout-ms 15000 cmux browser surface:7 wait --load-state complete --timeout-ms 15000
cmux browser surface:7 snapshot --interactive cmux browser surface:7 snapshot --interactive
cmux --json browser surface:7 click e5 --snapshot-after
cmux browser surface:7 snapshot --interactive
``` ```
If `get url` is empty or `about:blank`, navigate first instead of waiting on load state.
## Deep-Dive References ## Deep-Dive References
| Reference | When to Use | | Reference | When to Use |

View file

@ -10,6 +10,7 @@ if [ -f "$STATE_FILE" ]; then
fi fi
cmux browser "$SURFACE" goto "$DASHBOARD_URL" cmux browser "$SURFACE" goto "$DASHBOARD_URL"
cmux browser "$SURFACE" get url
cmux browser "$SURFACE" wait --load-state complete --timeout-ms 15000 cmux browser "$SURFACE" wait --load-state complete --timeout-ms 15000
cmux browser "$SURFACE" snapshot --interactive cmux browser "$SURFACE" snapshot --interactive

View file

@ -5,6 +5,7 @@ URL="${1:-https://example.com/form}"
SURFACE="${2:-surface:1}" SURFACE="${2:-surface:1}"
cmux browser "$SURFACE" goto "$URL" cmux browser "$SURFACE" goto "$URL"
cmux browser "$SURFACE" get url
cmux browser "$SURFACE" wait --load-state complete --timeout-ms 15000 cmux browser "$SURFACE" wait --load-state complete --timeout-ms 15000
cmux browser "$SURFACE" snapshot --interactive cmux browser "$SURFACE" snapshot --interactive