Gathering detailed insights and metrics for @axe-core/puppeteer
Gathering detailed insights and metrics for @axe-core/puppeteer
Gathering detailed insights and metrics for @axe-core/puppeteer
Gathering detailed insights and metrics for @axe-core/puppeteer
axe-puppeteer
An aXe-core integration for Puppeteer
axe-scan
A CLI tool to test web accessibility on multiple web pages based on a list of URLs in a text file.
@axe-core/pupeeteer
Provides a chainable axe API for Puppeteer and automatically injects into all frames
axe-runner
Run accessibility verification of multiple pages with Puppeteer and axe-core, and output the result to a CSV file.
npm install @axe-core/puppeteer
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (59.3%)
TypeScript (40.49%)
HTML (0.12%)
CSS (0.08%)
Shell (0.01%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MPL-2.0 License
664 Stars
620 Commits
73 Forks
12 Watchers
75 Branches
40 Contributors
Updated on Jul 15, 2025
Latest Version
4.10.2
Package Id
@axe-core/puppeteer@4.10.2
Unpacked Size
58.57 kB
Size
13.84 kB
File Count
7
NPM Version
lerna/8.1.3/node@v22.16.0+x64 (linux)
Node Version
22.16.0
Published on
Jun 03, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
1
Provides a chainable axe API for Puppeteer and automatically injects into all frames.
Previous versions of this program were maintained at dequelabs/axe-puppeteer.
Install Node.js if you haven't already.
Install Puppeteer: npm install puppeteer
Install @axe-core/puppeteer: npm install @axe-core/puppeteer
This module uses a chainable API to assist in injecting, configuring and analyzing using axe with Puppeteer. As such, it is required to pass an instance of a Puppeteer Page
or Frame
.
Here is an example of a script that will drive Puppeteer to this repository, perform analysis and then log results to the console.
1const { AxePuppeteer } = require('@axe-core/puppeteer'); 2const puppeteer = require('puppeteer'); 3 4(async () => { 5 const browser = await puppeteer.launch(); 6 const page = await browser.newPage(); 7 await page.goto('https://dequeuniversity.com/demo/mars/'); 8 9 try { 10 const results = await new AxePuppeteer(page).analyze(); 11 console.log(results); 12 } catch (e) { 13 // do something with the error 14 } 15 16 await browser.close(); 17})();
Note: Usage examples make use of ES2017 async/await. Use of await
can only be done in a function
declared async
. If your project does not support async/await, you can just directly use the promise
async
functions return. Check here for more
information.
When trying to run axe, you might run into issues if the page you are checking has Content Security Policy enabled. To get around this, you must disable it through Page#setBypassCSP
before navigating to the site.
An alternate constructor is available which opens a page and performs the CSP bypass for you.
It closes the page after analyze
is called.
1const { loadPage } = require('@axe-core/puppeteer'); 2const puppeteer = require('puppeteer'); 3 4(async () => { 5 const browser = await puppeteer.launch(); 6 const axeBuilder = await loadPage( 7 browser, 8 'https://dequeuniversity.com/demo/mars/' 9 ); 10 const results = await axeBuilder.analyze(); 11 console.log(results); 12 13 await browser.close(); 14})();
Constructor for the AxePuppeteer helper.
You must pass an instance of a Puppeteer Frame
or Page
as the first argument. Cannot be called without the new
keyword.
1const builder = new AxePuppeteer(page);
If you wish to run a specific version of axe-core, you can pass the source axe-core
source file in as a string. Doing so will mean axe-puppeteer runs this version of axe-core, instead of the one installed as a dependency of axe-puppeteer.
1const axeSource = fs.readFileSync('./axe-3.0.js', 'utf8'); 2const builder = new AxePuppeteer(page, axeSource);
Note that you might need to bypass the Content Security Policy in some cases.
Performs analysis and passes any encountered error and/or the result object to the provided callback function or promise function. Does not chain as the operation is asynchronous
Using the returned promise (optional):
1new AxePuppeteer(page) 2 .analyze() 3 .then(function (results) { 4 console.log(results); 5 }) 6 .catch(err => { 7 // Handle error somehow 8 });
Using a callback function
1new AxePuppeteer(page).analyze(function (err, results) { 2 if (err) { 3 // Handle error somehow 4 } 5 console.log(results); 6});
Adds a CSS selector to the list of elements to include in analysis
1new AxePuppeteer(page).include('.results-panel');
Add a CSS selector to the list of elements to exclude from analysis
1new AxePuppeteer(page).include('.results-panel').exclude('.results-panel h2');
Specifies options to be used by axe.run
. Will override any other configured options, including calls to withRules
and withTags
.
See axe-core API documentation
for information on its structure.
1new AxePuppeteer(page).options({ 2 checks: { 'valid-lang': ['orcish'] } 3});
Limits analysis to only those with the specified rule IDs. Accepts a String of a single rule ID or an Array of multiple rule IDs. Subsequent calls to AxePuppeteer#options
, AxePuppeteer#withRules
or AxePuppeteer#withRules
will override specified options.
1new AxePuppeteer(page).withRules('html-lang');
1new AxePuppeteer(page).withRules(['html-lang', 'image-alt']);
Limits analysis to only those with the specified tag or tags. Accepts a String of a single tag or an Array of multiple tags. Subsequent calls to AxePuppeteer#options
, AxePuppeteer#withRules
or AxePuppeteer#withRules
will override specified options.
1new AxePuppeteer(page).withTags('wcag2a');
1new AxePuppeteer(page).withTags(['wcag2a', 'wcag2aa']);
Skips verification of the rules provided. Accepts a String of a single rule ID or an Array of multiple rule IDs. Subsequent calls to AxePuppeteer#options
, AxePuppeteer#disableRules
will override specified options.
1new AxePuppeteer(page).disableRules('color-contrast');
or use it combined with some specified tags:
1new AxePuppeteer(page)
2 .withTags(['wcag2a', 'wcag2aa'])
3 .disableRules('color-contrast');
Skips specific frame with selector provided. Accepts a String of a single selector. Subsequent calls to AxePuppeteer#options
, AxePuppeteer#disableFrame
will override specified options.
1new AxePuppeteer(page).disableFrame('#my-frame');
or use it combined with some specified tags:
1new AxePuppeteer(page)
2 .withTags(['wcag2a', 'wcag2aa'])
3 .disableFrame('#my-frame');
Inject an axe configuration object to modify the ruleset before running Analyze. Subsequent calls to this method will invalidate previous ones by calling axe.configure
and replacing the config object. See axe-core API documentation for documentation on the object structure.
1const config = { 2 checks: [Object], 3 rules: [Object] 4}; 5const results = await new AxePuppeteer(page).configure(config).analyze(); 6console.log(results);
Set the frame testing method to "legacy mode". In this mode, axe will not open a blank page in which to aggregate its results. This can be used in an environment where opening a blank page is causes issues.
With legacy mode turned on, axe will fall back to its test solution prior to the 4.3 release, but with cross-origin frame testing disabled. The frame-tested
rule will report which frames were untested.
Important Use of .setLegacyMode()
is a last resort. If you find there is no other solution, please report this as an issue.
1const axe = new AxePuppeteer(page).setLegacyMode(); 2const result = await axe.analyze(); 3axe.setLegacyMode(false); // Disables legacy mode
Due to axe-core needing to be injected into the page and executed we are unable to do the following:
1await page.setJavaScriptEnabled(false);
No vulnerabilities found.
Reason
all changesets reviewed
Reason
security policy file detected
Details
Reason
14 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 5
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
14 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More