Testing pages with CLI

Link to Testing pages with CLI copied to clipboard

There are a variety of options available when to test individual pages.

When using the URI input mode, a number of additional options are available to adjust the scope and ruleset of a test. For example, the following code will exclude the header and footer from a test, and has the color-contrast rule disabled:

axe http://example.com --exclude footer,header --disable color-contrast

Options

-i, --include <list>

CSS selector of included elements, comma separated

-e, --exclude <list>

CSS selector of excluded elements, comma separated

-a, --axe-source <path>

Path to axe.js file

-c, --custom

specify custom ruleset to use, overrides ruleset

-t, --tags <list>

Tags of rules to run, comma separated

--rules <list>

IDs of rules to run, comma separated

-l, --disable <list>

IDs of rules to disable, comma separated

-s, --save [filename]

Save the output as a JSON file. Filename is optional'

-d, --dir <path>

Output directory

-j, --stdout

Output results to STDOUT and silence all other output

-r, --report <output-dir>

generate a report

-f, --format <value>

specify report type(s) [html|junit|csv|html+junit+csv]

--filter [type(s)]

Provide a list of result types to filter from results: passes, violations, incomplete, inapplicable. (--format csv required)

axe reporter ./axe-reports/json/ --format=csv --filter passes,inapplicable

-q, --exit

Exit with 1 failure code if any a11y tests fail

--load-delay <n>

Set how much time (milliseconds) axe will wait after page load before running the audit (default: 0)

--timer

Log the time it takes to run

--show-errors

Display the full error stack

--no-reporter

Turn the CLI reporter off

--chrome-options [options]

Options to provide to headless Chrome

-v, --verbose

Output metadata like test tool name, version and environment

--chromedriver-path <path>

Absolute path to the desired chromedriver executable

Configuration flags

For more options, see configuration flags