# --navigator-script

Source: https://zshot-cli.com/reference/flags/navigator/navigator-script/
Markdown: https://zshot-cli.com/reference/flags/navigator/navigator-script/index.md
Section: [Reference](https://zshot-cli.com/reference/) › [Flags](https://zshot-cli.com/reference/flags/) › [Navigator](https://zshot-cli.com/reference/flags/navigator/)
CLI: `--navigator-script` · REST: [`navigator_script`](https://zshot-cli.com/reference/server/api/schema/#navigator_script)
Value: `[TITLE=]SOURCE`
License: [Pro](https://zshot-cli.com/support/licenses/pro)

Gives the navigator a [script](/reference/navigator/data-and-files#scripts) it runs on the current page with `RUN_SCRIPT`, such as an accessibility audit or extracting a table as JSON. The title is free text that tells the navigator what the script returns. Repeatable, up to 20.

| Source | Where |
| --- | --- |
| A JavaScript file | Command line |
| An `http(s)` URL | Command line and server |
| `data:text/javascript,…` or `data:text/javascript;base64,…` | Command line and server |

The source runs in the page as the body of an async function, and what it returns is the result: a promise is awaited and the value is shown to the navigator as JSON for that step. A script that throws, returns nothing or returns a value that cannot be serialized as JSON is reported to the navigator as such. Sources are loaded when the session starts, capped at 4 MiB each with a 30-second fetch timeout, and one that fails to load is skipped with a warning. Results are truncated at 60,000 characters, and the navigator runs up to 4 scripts per step. In server mode, pass `http(s)` URLs or `data:` URIs per request in `navigator_script` as strings or `{"title", "source"}` objects; the CLI flag is rejected at server startup.

## Example

[`axe-audit.js`](/scripts/axe-audit.js) runs the [axe-core](https://github.com/dequelabs/axe-core) accessibility rules and returns the violations it finds.

**CLI**

```sh
zshot -t goal \
  --navigator-type "anthropic://YOUR_API_KEY@" \
  --navigator-script "axe accessibility audit, JSON violations for this page=https://zshot-cli.com/scripts/axe-audit.js" \
  --navigate "Report the accessibility violations on this page" \
  https://zshot-cli.com/example_assets/zemu/
```

**JSON** — `POST /` body for the [API](/reference/server/api), Pro license

```json
{
  "url": "https://zshot-cli.com/example_assets/zemu/",
  "output_type": "goal",
  "navigate": "Report the accessibility violations on this page",
  "navigator_type": ["anthropic://YOUR_API_KEY@"],
  "navigator_script": [
    {
      "title": "axe accessibility audit, JSON violations for this page",
      "source": "https://zshot-cli.com/scripts/axe-audit.js"
    }
  ]
}
```

**curl**

```sh
curl -X POST http://127.0.0.1:3000/ \
  -H "Content-Type: application/json" \
  -d '{"url":"https://zshot-cli.com/example_assets/zemu/","output_type":"goal","navigate":"Report the accessibility violations on this page","navigator_type":["anthropic://YOUR_API_KEY@"],"navigator_script":[{"title":"axe accessibility audit, JSON violations for this page","source":"https://zshot-cli.com/scripts/axe-audit.js"}]}'
```

## Related

Flags:

- [`--navigate`](https://zshot-cli.com/reference/flags/navigator/navigate/)
- [`--navigator-reference`](https://zshot-cli.com/reference/flags/navigator/navigator-reference/)
- [`--navigator-step-timeout`](https://zshot-cli.com/reference/flags/navigator/navigator-step-timeout/)
- [`--javascript`](https://zshot-cli.com/reference/flags/browser/javascript/)
- [`--request-scripts`](https://zshot-cli.com/reference/flags/security/request-scripts/)

Topics:

- [Data and Files](https://zshot-cli.com/reference/navigator/data-and-files/)
- [Audit accessibility with a script](https://zshot-cli.com/examples/accessibility-audit/)

## Navigation

- [Examples](https://zshot-cli.com/examples/)
- [Download](https://zshot-cli.com/download/)
- [Purchase](https://zshot-cli.com/purchase/)
- [Reference](https://zshot-cli.com/reference/)
  - [Formats](https://zshot-cli.com/reference/formats/)
  - [Flags](https://zshot-cli.com/reference/flags/)
    - [Common](https://zshot-cli.com/reference/flags/common/)
    - [Agents](https://zshot-cli.com/reference/flags/agents/)
    - [Archive](https://zshot-cli.com/reference/flags/archive/)
    - [Browser](https://zshot-cli.com/reference/flags/browser/)
    - [Diagnostics](https://zshot-cli.com/reference/flags/diagnostics/)
    - [Document](https://zshot-cli.com/reference/flags/document/)
    - [Image](https://zshot-cli.com/reference/flags/image/)
    - [Navigator](https://zshot-cli.com/reference/flags/navigator/)
      - [--navigate](https://zshot-cli.com/reference/flags/navigator/navigate/)
      - [--navigator-allow-url](https://zshot-cli.com/reference/flags/navigator/navigator-allow-url/)
      - [--navigator-captures-playwright](https://zshot-cli.com/reference/flags/navigator/navigator-captures-playwright/)
      - [--navigator-captures-puppeteer](https://zshot-cli.com/reference/flags/navigator/navigator-captures-puppeteer/)
      - [--navigator-captures-video](https://zshot-cli.com/reference/flags/navigator/navigator-captures-video/)
      - [--navigator-credential](https://zshot-cli.com/reference/flags/navigator/navigator-credential/)
      - [--navigator-credential-env](https://zshot-cli.com/reference/flags/navigator/navigator-credential-env/)
      - [--navigator-credential-helper](https://zshot-cli.com/reference/flags/navigator/navigator-credential-helper/)
      - [--navigator-credential-helper-env](https://zshot-cli.com/reference/flags/navigator/navigator-credential-helper-env/)
      - [--navigator-credential-helper-timeout](https://zshot-cli.com/reference/flags/navigator/navigator-credential-helper-timeout/)
      - [--navigator-credential-origin](https://zshot-cli.com/reference/flags/navigator/navigator-credential-origin/)
      - [--navigator-credential-secret](https://zshot-cli.com/reference/flags/navigator/navigator-credential-secret/)
      - [--navigator-data](https://zshot-cli.com/reference/flags/navigator/navigator-data/)
      - [--navigator-data-json](https://zshot-cli.com/reference/flags/navigator/navigator-data-json/)
      - [--navigator-deny-url](https://zshot-cli.com/reference/flags/navigator/navigator-deny-url/)
      - [--navigator-escalation-max](https://zshot-cli.com/reference/flags/navigator/navigator-escalation-max/)
      - [--navigator-file](https://zshot-cli.com/reference/flags/navigator/navigator-file/)
      - [--navigator-file-size-limit](https://zshot-cli.com/reference/flags/navigator/navigator-file-size-limit/)
      - [--navigator-file-timeout](https://zshot-cli.com/reference/flags/navigator/navigator-file-timeout/)
      - [--navigator-frames](https://zshot-cli.com/reference/flags/navigator/navigator-frames/)
      - [--navigator-goal](https://zshot-cli.com/reference/flags/navigator/navigator-goal/)
      - [--navigator-initial-scope](https://zshot-cli.com/reference/flags/navigator/navigator-initial-scope/)
      - [--navigator-max-steps](https://zshot-cli.com/reference/flags/navigator/navigator-max-steps/)
      - [--navigator-reference](https://zshot-cli.com/reference/flags/navigator/navigator-reference/)
      - [--navigator-renders-when-impossible](https://zshot-cli.com/reference/flags/navigator/navigator-renders-when-impossible/)
      - **--navigator-script**
      - [--navigator-session-archived](https://zshot-cli.com/reference/flags/navigator/navigator-session-archived/)
      - [--navigator-stall-escalation](https://zshot-cli.com/reference/flags/navigator/navigator-stall-escalation/)
      - [--navigator-step-timeout](https://zshot-cli.com/reference/flags/navigator/navigator-step-timeout/)
      - [--navigator-type](https://zshot-cli.com/reference/flags/navigator/navigator-type/)
      - [--navigator-video-captions-position](https://zshot-cli.com/reference/flags/navigator/navigator-video-captions-position/)
      - [--navigator-video-height](https://zshot-cli.com/reference/flags/navigator/navigator-video-height/)
      - [--navigator-video-shows-captions](https://zshot-cli.com/reference/flags/navigator/navigator-video-shows-captions/)
      - [--navigator-video-shows-pointer](https://zshot-cli.com/reference/flags/navigator/navigator-video-shows-pointer/)
      - [--navigator-video-width](https://zshot-cli.com/reference/flags/navigator/navigator-video-width/)
    - [Security](https://zshot-cli.com/reference/flags/security/)
    - [Server](https://zshot-cli.com/reference/flags/server/)
    - [Video](https://zshot-cli.com/reference/flags/video/)
  - [Agents](https://zshot-cli.com/reference/agents/)
  - [Configuration](https://zshot-cli.com/reference/configuration/)
  - [Crawling](https://zshot-cli.com/reference/crawling/)
  - [Devices](https://zshot-cli.com/reference/devices/)
  - [Docker](https://zshot-cli.com/reference/docker/)
  - [Exit Codes](https://zshot-cli.com/reference/exit_codes/)
  - [Linux](https://zshot-cli.com/reference/linux/)
  - [LLM Connections](https://zshot-cli.com/reference/llm_connections/)
  - [npm](https://zshot-cli.com/reference/npm/)
  - [LLM Formatting](https://zshot-cli.com/reference/llm_formatting/)
  - [Local Inputs](https://zshot-cli.com/reference/inputs/)
  - [Navigator](https://zshot-cli.com/reference/navigator/)
  - [Security](https://zshot-cli.com/reference/security/)
  - [Server](https://zshot-cli.com/reference/server/)
  - [Shell completions](https://zshot-cli.com/reference/shell_completions/)
  - [Storage](https://zshot-cli.com/reference/storage/)
  - [Timeouts](https://zshot-cli.com/reference/timeouts/)
  - [Web Bot Auth](https://zshot-cli.com/reference/web_bot_auth/)
- [Support](https://zshot-cli.com/support/)
- [Changelog](https://zshot-cli.com/changelog/)

Site index: https://zshot-cli.com/llms.txt

