Get Started with Axe DevTools CLI

This page is not available in the language you requested. You have been redirected to the English version of the page.
Link to this page copied to clipboard
Not for use with personal data

Before getting started, install Axe DevTools CLI.

Axe DevTools CLI runs via the axe command. This guide covers the three most common tasks:

Analyze a Web Page

Pass one or more URLs directly to the axe command. By default, the CLI uses Firefox and runs the WCAG 2.1 AA ruleset, printing results to stdout:

axe https://example.com/

Analyze multiple pages at once:

axe https://example.com/ https://example.com/about.html

Save results as a JSON file for later use:

axe https://example.com/ --save=./axe-results.json

Generate an HTML report directly:

axe https://example.com/ --report=./axe-reports/

For all options, see Analyze Pages.

Analyze Pages Using a Spec File

For more complex scenarios such as navigating through a single-page app, logging in, dismissing dialogs, or analyzing a page at multiple points in a workflow, use the axe spec command with a spec file.

A spec file (JSON or YAML) defines a list of pages to analyze and the actions to take on each page before analyzing. A minimal example (axe-workflow.yaml):

projects:
  - name: example
    id: example
    pageList:
      - name: Homepage
        url: https://example.com/
      - name: Search Results
        url: https://example.com/
        actions:
          - type "axe" into element "#searchform input"
          - click element "#searchform button[type=submit]"
          - wait for element ".search-results" to be found
          - analyze

Run it with axe spec, specifying the spec file and an output directory for results:

axe spec ./axe-workflow.yaml ./axe-results

For a full reference of spec file structure, actions, and options, see Analyze Pages Using a Spec File.

Generate a Report from Saved Results

Use the axe reporter command to convert saved JSON results into HTML, JUnit XML, or CSV:

axe reporter ./axe-results --format=html

Generate a JUnit XML report (useful in CI pipelines):

axe reporter ./axe-results --format=junit

Generate a CSV report:

axe reporter ./axe-results --format=csv

For filtering and other options, see Generate Reports.

Next Steps