Testing pages with 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

Options for testing individual web pages with the Axe DevTools for Web CLI

Not for use with personal data

When using the CLI's URI input mode, several additional options are available to change the scope and ruleset of a test. For example, the following code will exclude the header and footer from a test and will disable the color-contrast rule:

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

Options

-a, --axe-source <path>

Path to an alternative axe.js file. Most users do not need this option. It is intended for advanced use cases such as testing against a specific or patched version of axe-core.

--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.

--axe-devhub-server-url <url>

Specify the URL of the Axe Developer Hub server. Defaults to https://axe.deque.com. Equivalent to the AXE_DEVHUB_SERVER_URL environment variable. See Using the CLI to Send Accessibility Results to Axe Developer Hub for more information.

-c, --custom <path>

Specify a custom ruleset to use. See Custom Rulesets for details on generating a ruleset file.

--chrome-options [options]

Comma-separated list of Chrome command-line switches to pass to the browser. For example:

axe http://example.com --chrome-options="some-switch,some-other-switch"

--chrome-path <path>

Absolute path to the Chrome browser executable. Use this to point axe at a specific Chrome installation when the default browser cannot be found, or you need to run against a particular version.

--chromedriver-path <path>

Absolute path to the ChromeDriver executable. ChromeDriver is a separate binary from the Chrome browser itself; it acts as a bridge that translates axe's WebDriver commands into instructions Chrome can execute.

-d, --dir <path>

The directory where the JSON results file is saved. Without this flag (or --save or --report), no file is written, and results are printed to the terminal as a human-readable summary instead. See also -j, --stdout if you need machine-readable output without writing to disk.

-l, --disable <list>

Comma-separated list of rule IDs to disable. See the axe-core rule descriptions for a full list of rule IDs.

axe http://example.com --disable color-contrast,duplicate-id

-e, --exclude <list>

Comma-separated list of CSS selectors for elements to exclude from testing. For example:

# Exclude by element type
axe http://example.com --exclude footer,header

# Exclude by class or ID
axe http://example.com --exclude ".ad-banner,#cookie-notice"

# Exclude by attribute
axe http://example.com --exclude "[aria-hidden=true]"

-f, --format <value>

Format of the generated report. Requires -r, --report. See Creating and Filtering Reports for details on what each format contains. Default: html.

Value Output
html HTML report
junit JUnit XML report
csv CSV spreadsheet
html+junit+csv All three formats at once
axe http://example.com --report ./reports --format html+junit+csv

--filter <list>

Comma-separated list of result types to include in the CSV output. Only the specified types will appear; all others are excluded. Valid values are passes, violations, incomplete, and inapplicable. Requires --format csv.

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

-i, --include <list>

Comma-separated list of CSS selectors. When specified, axe tests only the matching elements, and everything else on the page is ignored. This is highly restrictive, and most users should use -e, --exclude instead. Use --include only when you want to isolate testing to a specific component, such as during focused debugging or component-level CI checks.

# Test only the main navigation
axe http://example.com --include nav

# Test only elements with a specific class or ID
axe http://example.com --include ".my-widget,#signup-form"

# Test only elements with a specific attribute
axe http://example.com --include "[data-testid=checkout]"

-j, --stdout

Write the full results as machine-readable JSON to stdout instead of the human-readable terminal summary. All other output is silenced. Use this when piping results to another program.

--load-delay <n>

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

--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.

--no-reporter

Suppresses the violation summary output (rule IDs, counts, affected selectors, and help URLs) without silencing everything. Progress messages and results written to disk via --save, --dir, or --report are unaffected. Primarily useful in CI pipelines where you are saving results to a file and using --exit for pass/fail signaling and don't want verbose violation details in the build log. For complete silence with JSON results output, use -j, --stdout instead.

-q, --exit

Exit with 1 failure code if any accessibility tests fail.

-r, --report <output-dir>

The directory where the formatted report is written. Works with -f, --format to control the output format (HTML by default). Use this when you want a human-readable or machine-parseable report rather than raw JSON, for example, an HTML report for sharing with stakeholders or a JUnit XML file for CI integration. For raw JSON output, use -d, --dir instead.

--rules <list>

Comma-separated list of rule IDs to run. Only the specified rules are checked; all others are skipped. See the axe-core rule descriptions for a full list of rule IDs.

axe http://example.com --rules color-contrast,duplicate-id

-s, --save [filename]

Save the results as a JSON file in the current directory. The filename is optional; if omitted, the file is named axe-result.json. To save to a specific directory instead, use -d, --dir.

--show-errors

When axe encounters a runtime error (such as a failure to initialize or an exception thrown during execution), it normally prints a brief error message to stderr. This flag adds the full stack trace to that output. It does not affect how accessibility violations are reported. Use this when debugging a custom --axe-source file, diagnosing unexpected failures in CI, or gathering information for a bug report.

-t, --tags <list>

Comma-separated list of tags to filter which rules are run. Only rules matching at least one of the specified tags are included. See the axe-core tags documentation for a full list of available tags.

axe http://example.com --tags wcag2a,wcag2aa

--timer

Prints three timing measurements to the terminal after each test run:

  • axe page load time: how long the page took to load in the browser
  • axe-core execution time: how long axe-core took to analyze the page
  • Total test time: end-to-end elapsed time for the run

Use this to diagnose slow tests. For example, use this option to determine whether the time is spent waiting for the page to load or in Axe analysis, or to investigate why a run is hitting --page-timeout or --script-timeout limits.

-v, --verbose

When violations are found, it prints a JSON block after the violation summary containing:

  • Test Engine: the axe-core version used
  • Test Environment: browser user agent, viewport width and height, and screen orientation
  • Test Runner: the runner name

Note that this output only appears when violations are detected. If a page has no violations, the metadata is not printed. Use this when you need to confirm exactly which axe-core version ran, verify viewport settings, or include environment details in a bug report.

Configuration options

The following options control browser behavior and test timing. Unlike the options above, these persist between CLI runs; setting them once saves the value to a preferences file used for all future runs. They can also be set interactively using axe config-selenium.

Option Description
--accept-untrusted Accept untrusted SSL certificates.
--browser [browser-name] Browser to run. Requires the Selenium WebDriver binding for the chosen browser.
--headless Launch the browser in headless mode (no visible window).
--page-timeout [ms] Maximum time to wait for a page to load. Default: 60000.
--post-analyze-pause [ms] Pause between starting page analysis and moving to the next action. Default: 2000.
--post-get-pause [ms] Pause between page load and starting the scan. Default: 2000.
--post-script-pause [ms] Pause between a scripting action and starting the scan. Default: 2000.
--remote-server [server-url] Use a remote WebDriver server such as BrowserStack or Sauce Labs.
--script-timeout [ms] Maximum time allowed for a spec file script to run. Default: 60000.
--window-size <width,height> Set the viewport size in pixels, e.g. --window-size=1280,800. Also applies in headless mode.

For full details, see Configuration Options.