2.3 KiB
2.3 KiB
Command Reference
All scripts accept the shared flags --json, --quiet, --port=<number>, --host=<host>, --ws=<endpoint>, and --timeout=<ms>. Without --json, STDOUT still emits machine-readable JSON while human logs go to STDERR.
start.js
node scripts/start.js [--profile[=path]] [--chrome-path=<path>] [--user-data-dir=<path>]
- Detects Chrome/Chromium automatically across macOS, Linux, and Windows.
- Copies the default browser profile when
--profileis set, or from a custom path when supplied. - Returns
{ ok, port, userDataDir, chromePath, profile }.
navigate.js
node scripts/navigate.js <url> [--new] [--wait=domcontentloaded|networkidle0|load|none]
- Reuses the active tab by default;
--newopens a new page. - Emits
{ ok, url, newPage }.
evaluate.js
node scripts/evaluate.js <expression>
node scripts/evaluate.js --file snippet.js
- Supports inline, file-based, or piped expressions; structured clone results are returned under
result. - When not in
--jsonmode the evaluated value (truncated to 8 KB) is echoed to STDOUT.
screenshot.js
node scripts/screenshot.js [--element=<selector>] [--format=png|jpeg] [--quality=80] [--out=path]
- Saves to a temporary directory when
--outis omitted and prints the absolute path. - Element captures rely on the supplied selector; full-page captures default to PNG.
element.js
node scripts/element.js <selector>
node scripts/element.js --text "Buy now"
node scripts/element.js # interactive picker
--clickand--scrollact on the resolved element before returning metadata.- Interactive mode waits up to 60 s for a click inside Chrome and restores page styling afterwards.
cookies.js
node scripts/cookies.js --export [path] [--domain=example.com]
node scripts/cookies.js --import cookies.json
node scripts/cookies.js --clear [--domain=example.com]
- Uses Chrome DevTools
Network.*commands for reliable cookie management. - Export payloads include metadata (
exportedAt,pageUrl,cookies[]).
close.js
node scripts/close.js [--force]
- Attempts graceful shutdown first; falls back to process termination on failure.
- Returns
{ ok, port, graceful, forced, closedTabs }.