agentchrome 1.62.0

A CLI tool for browser automation via the Chrome DevTools Protocol
Documentation
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.TH script 1  "script "
.SH NAME
script \- Execute a batch script of agentchrome commands
.SH SYNOPSIS
\fBscript\fR [\fB\-h\fR|\fB\-\-help\fR] <\fIsubcommands\fR>
.SH DESCRIPTION
Execute a JSON batch script composed of agentchrome commands, conditional branches, and loops against the active CDP session. The script runs sequentially and emits a structured JSON result array on stdout. Use \*(Aqscript run \-\*(Aq to read a script from stdin.
.PP
SCRIPT FORMAT (JSON v1):
{ "commands": [
{ "cmd": ["navigate", "https://example.com"] },
{ "cmd": ["js", "exec", "document.title"], "bind": "title" },
{ "if": "$vars.title.includes(\*(AqExample\*(Aq)",
"then": [{ "cmd": ["page", "snapshot"] }],
"else": [] },
{ "loop": { "count": 3 }, "body": [{ "cmd": ["interact", "click", "s1"] }] }
] }
.SH OPTIONS
.TP
\fB\-h\fR, \fB\-\-help\fR
Print help (see a summary with \*(Aq\-h\*(Aq)
.SH SUBCOMMANDS
.TP
script\-run(1)
Run a JSON batch script
.TP
script\-help(1)
Print this message or the help of the given subcommand(s)
.SH EXTRA
EXAMPLES:
  # Run a script file
  agentchrome script run workflow.json

  # Read a script from stdin
  echo \*(Aq{"commands":[{"cmd":["navigate","https://example.com"]}]}\*(Aq | agentchrome script run \-

  # Stop at the first failure
  agentchrome script run \-\-fail\-fast workflow.json

  # Validate a script without dispatching any commands
  agentchrome script run \-\-dry\-run workflow.json

  # Chain navigate and js exec to extract the page title
  agentchrome script run \- <<\*(AqEOF\*(Aq
{"commands":[
  {"cmd":["navigate","https://example.com"]},
  {"cmd":["js","exec","document.title"],"bind":"title"}
]}
EOF
.SH CAPABILITIES
.PP
Execute a batch script of agentchrome commands
.TP
.B script run
Run a JSON batch script
.TP
.B file
Path to a JSON script file; use '-' to read from stdin
.TP
.B --fail-fast
Stop execution at the first failing step and exit non-zero
.TP
.B --dry-run
Parse and validate the script without executing any commands
.SH EXAMPLES
.PP
Examples:
.TP
.B \`agentchrome script run script.json\`
Execute all commands in script.json sequentially
.TP
.B \`agentchrome script run script.json --fail-fast\`
Stop on the first failing step and exit non-zero
.TP
.B \`agentchrome script run script.json --dry-run\`
Validate the script schema without dispatching to Chrome
.TP
.B \`agentchrome script run -\`
Read the script from stdin instead of a file
.TP
.B \`echo '{"commands":[{"cmd":["page","find","Submit"],"bind":"match"},{"cmd":["interact","click","$vars.match[0].uid"]}]}' | agentchrome script run -\`
Discover an element via page find, bind the result, then click it
.TP
.B \`echo '{"commands":[{"cmd":["page","screenshot","--file","out.png"]}]}' | agentchrome script run -\`
Capture a screenshot to a file from inside a script