Using axe command line to evaluate a web page for accessibility

Introduction:

Saptarshi Katwala
accessibility-a11y
Published in
3 min readFeb 24, 2019

--

axe-core is a JavaScript Framework for enabling automated testing of Web Pages for identifying Accessibility issues. It is high configurable, open source and has the backing of Deque Systems — which is a prominent company in the accessibility and the digital equality space. This article shows how to get started with axe-core and how to use this to test a web pages using command line.

Intended audience:

  • Developers
  • QA — Testers of Web pages
  • Product Owners of IT Web Applications

Downloading axe-core

axe-core is an open source JavaScript framework available as a download via npm — node package manager.

To download axe-core, Node JS needs to be installed. Here are the instructions for installing Node JS.

Once Node JS is installed, one can install axe-core by the following command:

This installs axe globally and can be accessed from any folder in the file system.

Once installed, to test any web page, use the following command.

The above command will test the page at the specific url and save the results in a file called results.json. The value of the time out can be changed. The tags option specifies the rules to be run. There are several tags supported oiut of the box by axe framework. For the above example we are running the WCAG2.0 rules at level A. Other tags include

  • wcag21aa (Level AA of WCAG 2.1 guidelines)
  • section508 (guidelines for section 508)
  • experimental
  • best-practice (as endorsed by Deque systems on accessibility)

E.g. to test www.google.com, use the following command:

Running this produces the following output:

It identifies 2 violations (these results as these violations may get rectified). A detailed report is saved in file results.json. Open this file in a JSON editor. Drill down to the violations attribute. The details of the Accessibility violations along with suggestions for fixes will be seen.

Conclusion

axe-core is a very powerful framework that can help developers and IT teams build web products that are inclusive. In this article we have seen how to do install and use axe-core for testing a web page. In another article, we will look at how to include this framework in local codebase and how to run this framework and the accessibility rules during each build of the codebase.

--

--

Saptarshi Katwala
accessibility-a11y

I am a software developer/applications architect. I have a special interest in Web Accessibility.