Testing pages with CLI
There are a variety of options available for testing 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-contrastOptions
--axe-devhub-api-key <your-API-key>
Specify the axe Account API key to use for sending accessibility results to axe Developer Hub. Results are sent to the project associated with the specified project ID (specified with the --axe-devhub-project-id command-line option) after testing is completed. Both --axe-devhub-api-key and --axe-devhub-project-id are required to send results to axe Developer Hub. See Using the CLI to Send Accessibility Results to axe Developer Hub for more information.
--axe-devhub-project-id <your-project-ID>
Specify the axe Developer Hub project ID to receive accessibility test results. Both --axe-devhub-api-key and --axe-devhub-project-id are required to send results to axe Developer Hub. See Using the CLI to Send Accessibility Results to axe Developer Hub for more information.
-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 a 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
--no-git-data
Do not report Git branch and commit information when sending results to axe Developer Hub. See [Using the CLI to Send Accessibility Results to axe Developer Hub.
--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
