# Audit accessibility with a script

Source: https://zshot-cli.com/examples/accessibility-audit/
Markdown: https://zshot-cli.com/examples/accessibility-audit/index.md
Section: [Examples](https://zshot-cli.com/examples/)
License: [Pro](https://zshot-cli.com/support/licenses/pro)

Give the navigator the [axe-core](https://github.com/dequelabs/axe-core) audit script, run it on the [Zemu](https://zshot-cli.com/example_assets/zemu/) storefront, and save its report to [`audit.txt`](/example-renders/accessibility-audit.txt). The navigator in this example uses Anthropic with an API key you must provide.

**CLI**

```sh
zshot -f audit.txt \
  -t goal \
  --navigate "Run the accessibility audit and report each violation with its impact and how many elements fail" \
  --navigator-script "axe accessibility audit, JSON violations for this page=https://zshot-cli.com/scripts/axe-audit.js" \
  --navigator-type "anthropic://YOUR_API_KEY@" \
  "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": "Run the accessibility audit and report each violation with its impact and how many elements fail",
  "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":"Run the accessibility audit and report each violation with its impact and how many elements fail","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"}]}' \
  -o audit.txt
```

Expected output: [accessibility-audit.txt](/example-renders/accessibility-audit.txt)

```
The axe accessibility audit (axe 4.14.1) ran on this page, why-zemu.html. It found **2 violations**, and 42 rules passed. 1. **color-contrast** (Elements must meet minimum color contrast ratio thresholds): impact **serious**, **14 failing elements** (5 listed plus 9 more). - The cart link label is white on #ff5a1f, a ratio of 3.11:1. - The category nav links (All, Home, Health, Tech) are white on #e0430c, a ratio of 4.21:1. - The required ratio is 4.5:1. 2. **region** (All page content should be contained by landmarks): impact **moderate**, **1 failing element** (`.demobar`). Axe also flagged color-contrast as **incomplete** (needs manual review) on 13 more elements, rated serious. Mostly it could not work out the background colour because of gradients, for example `.demobar`, `#shield-score` and the sale modal heading.
```

## Related

Flags:

- [`--navigate`](https://zshot-cli.com/reference/flags/navigator/navigate/)
- [`--navigator-script`](https://zshot-cli.com/reference/flags/navigator/navigator-script/)
- [`--navigator-type`](https://zshot-cli.com/reference/flags/navigator/navigator-type/)
- [`--request-scripts`](https://zshot-cli.com/reference/flags/security/request-scripts/)
- [`--output-type`](https://zshot-cli.com/reference/flags/common/output-type/)

Topics:

- [Data and Files](https://zshot-cli.com/reference/navigator/data-and-files/) — Scripts, data, files and references a navigator is given
- [Goal](https://zshot-cli.com/reference/formats/goal/) — What the navigator said when it finished
- [AXTree](https://zshot-cli.com/reference/formats/axtree/) — The accessibility tree of a page

## Navigation

- [Examples](https://zshot-cli.com/examples/)
  - [Webpage as PNG](https://zshot-cli.com/examples/hello-from-zshot/)
  - [Full-page phone screenshot](https://zshot-cli.com/examples/full-page-phone/)
  - [Wait for a JavaScript event](https://zshot-cli.com/examples/wait-for-event/)
  - [Rendered HTML](https://zshot-cli.com/examples/html-output/)
  - [Tablet screenshot](https://zshot-cli.com/examples/tablet-screenshot/)
  - [Dark mode](https://zshot-cli.com/examples/dark-mode/)
  - [Emulate geolocation](https://zshot-cli.com/examples/geolocation/)
  - [Accessible PDF](https://zshot-cli.com/examples/accessible-pdf/)
  - [WebM video](https://zshot-cli.com/examples/webm-video/)
  - [Animated GIF](https://zshot-cli.com/examples/animated-gif/)
  - [Log in, then capture](https://zshot-cli.com/examples/navigate-login/)
  - [Log in, then extract JSON](https://zshot-cli.com/examples/sales-report-json/)
  - [Upload a file, download the result](https://zshot-cli.com/examples/enhance-leads/)
  - [Turn a bug into a test](https://zshot-cli.com/examples/agent-regression-test/)
  - **Audit accessibility with a script**
  - [Crawl a site into a WACZ](https://zshot-cli.com/examples/crawl-links/)
  - [Archive a sitemap into a WACZ](https://zshot-cli.com/examples/wacz-sitemap/)
  - [Run an API server](https://zshot-cli.com/examples/api-server/)
  - [Signed URL support](https://zshot-cli.com/examples/menu-board/)
  - [Browser as a CDN](https://zshot-cli.com/examples/browser-as-a-cdn/)
- [Download](https://zshot-cli.com/download/)
- [Purchase](https://zshot-cli.com/purchase/)
- [Reference](https://zshot-cli.com/reference/)
- [Support](https://zshot-cli.com/support/)
- [Changelog](https://zshot-cli.com/changelog/)

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

