Automation

Automated Accessibility checks with Pa11y

Pa11y

Pa11y is a automated accessibility testing library. Pa11y can be used as a command line tool to check accessibility of our website with different standards.  In this post, we will see how to setup automated accessibility.

Requirements

  • NodeJS
  • PhantomJS

I have installed PhantomJS and NodeJS installed on OSX Yosemite with HomeBrew.

Create Project

Let’s create a project with a pakage.json files.

Install Packages

Now, we got ‘pa11y’ and ‘pa11y rainbows reporter’ packages inside our package.json. We can install these package using ‘npm install’ which creates ‘node_modules’ directory.

pa11-install

 

Now that we have installed ‘pa11y’ inside ‘node_modules’ directory. We can run it for Google website.

This will print results in the standard format. It look like this:

google-std

 Accessibility standard used by default ‘WCAG2AA’ but we can run it with different format like 

The out produced above is the standard. We now use it with ‘rainbow-reporter‘.

Create Script

To make all simple, let’s create a script which takes STANDARD and URL as a parameter and run it using rainbows reporter

Now we can execute this script to check any url with different accessibility standards.

The output looks like this:

google-accessibility

 Now, we got nice reports in the terminal.

Source Code: ‘Automated-Accessibility‘ 

Conclusion

Automated accessibility checks can be performed on our existing web pages by using tools like ‘pa11y’.

  • syndy

    Hi, will pa11y check the sessions, cookies & login forms?? If so, how would I do that? Where to set this up? Any advice on this would be helpful. Thanks in advance.