Puppeteer Accessibility Audit
Lightweight library for performing accessibility audits of URL's or files using Chrome Accessibility Tools
Utilises GoogleChrome/puppeteer and GoogleChrome/accessibility-developer-tools.
Installation
npm install --save-dev puppeteer-accessibility-audit
or
yarn add --dev puppeteer-accessibility-audit
Usage
const paa = ; // Launch puppeteer to begin auditingawait paa; // Audit the supplied file and return the resultlet paaResult = await paa; // This is important to terminate any running chromium processesawait paa;
audit()
will return an object with two properties
audit
: An array containing every failure of that filereport
: Contains the result ofaxs.Audit.createReport
Config
Config can be supplied to paa.launch()
puppeteerConfig
is passed to: puppeteer.launchviewport
is passed to: page.setViewportauditScopeSelector
is used to target the audit and is passed to adocument.querySelector
.
For example
await paa;
Credits
Lots of copy and pasting of a11y by Addy Osmani