Get Started with Axe DevTools CLI
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.htmlSave results as a JSON file for later use:
axe https://example.com/ --save=./axe-results.jsonGenerate 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
- analyzeRun it with axe spec, specifying the spec file and an output directory for results:
axe spec ./axe-workflow.yaml ./axe-resultsFor 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=htmlGenerate a JUnit XML report (useful in CI pipelines):
axe reporter ./axe-results --format=junitGenerate a CSV report:
axe reporter ./axe-results --format=csvFor filtering and other options, see Generate Reports.
Next Steps
- Analyze Pages: all options for analyzing individual pages
- Analyze Pages Using a Spec File: spec files, actions, and batch processing
- Generate Reports: report formats, filtering, and JSON result structure
- Send to Axe Reports: upload results to the Axe Reports service
- Send to Axe Developer Hub: integrate results with Axe Developer Hub
- Configure: browser selection, timeouts, and persistent settings
- Custom Rulesets: WCAG 2.x, Section 508, and custom rulesets
