# Troubleshooting

## Common problems

### Element not in the tree, or several look identical

Take a screenshot-only and a tree-only snapshot and compare. If you can see
it but the tree cannot, run the element-discovery steps (`session guide
element-discovery`). Report the gap as a testability suggestion: missing
aria-label, clickable div instead of button, unlabeled input, repeated
generic rows without a test ID. Group suggestions at the end of your report.

### Click did nothing

Snapshot again; an overlay, dialog, or stale ref is the usual cause. Try
`session dismiss`, `session dialog --action accept|dismiss`, or scroll the
element into view. Refs change after the page changes: re-snapshot before
reusing one. Coordinates are the last resort.

### Page looks stuck

A slow page is not a broken page. `session wait --text "<expected>"
--timeout 30000`, then check `session network` for pending or failed
requests and `session console --only-errors` for script errors.

### Logged out or wrong user

Reload credentials with `session load-credential`, or sign in with a
`$CREDENTIAL` placeholder (`session guide sign-in`). For localhost, ask the
user to sign in.


### "No browser session is live" in an ADE session

Your browser ended: it was idle for 15 minutes, `cofactor dev app down` or a new
`up` replaced the copy, or the session ended. Run `cofactor session start` again.
(A request that reaches a different server than the one holding your browser is
asked again by the CLI on its own.)

### Multiple sessions

Pass `--session <id|name>` on every command, or `session stop --all` and
start clean.

### Screenshots cannot be read automatically

`cofactor session allow-screenshots` grants read access to the screenshot
folder (Claude Code).

## Rules

- Never print, request, or write down a password.
- Snapshot after every action.
- Stop the sessions you start.
