Gathering detailed insights and metrics for @axe-core/playwright
Gathering detailed insights and metrics for @axe-core/playwright
Gathering detailed insights and metrics for @axe-core/playwright
Gathering detailed insights and metrics for @axe-core/playwright
axe-playwright
Custom Playwright commands to inject axe-core and test for a11y
axe-playwright-report
Playwright + axe-core integration to run accessibility scans and build HTML dashboard reports.
expect-axe-playwright
Expect matchers to perform Axe accessibility tests in your Playwright tests.
a11y-test-mcp
An MCP (Model Context Protocol) server for performing a11y test on webpages using playwright axe-core. The results are then used in an agent loop with your favorite AI assistant (Cline/Cursor/GH Copilot) to find problems with a11y and suggest improvements
npm install @axe-core/playwright
Typescript
Module System
Node Version
NPM Version
JavaScript (59.32%)
TypeScript (40.47%)
HTML (0.12%)
CSS (0.08%)
Shell (0.01%)
Total Downloads
37,055,484
Last Day
24,622
Last Week
643,510
Last Month
2,731,209
Last Year
23,359,032
MPL-2.0 License
656 Stars
617 Commits
73 Forks
12 Watchers
76 Branches
40 Contributors
Updated on Jun 18, 2025
Latest Version
4.10.2
Package Id
@axe-core/playwright@4.10.2
Unpacked Size
61.63 kB
Size
11.93 kB
File Count
8
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
4.6%
24,622
Compared to previous day
Last Week
-4.4%
643,510
Compared to previous week
Last Month
0.9%
2,731,209
Compared to previous month
Last Year
136.7%
23,359,032
Compared to previous year
1
1
Provides a chainable axe API for playwright and automatically injects into all frames
Install Node.js if you haven't already.
Install Playwright: npm install playwright
Install @axe-core/playwright: npm install @axe-core/playwright
This module uses a chainable API to assist in injecting, configuring, and analyzing axe with Playwright. As such, it is required to pass an instance of Playwright.
Here is an example of a script that will drive Playwright to a page, perform an analysis, and then log results to the console.
1const { AxeBuilder } = require('@axe-core/playwright'); 2const playwright = require('playwright'); 3 4(async () => { 5 const browser = await playwright.chromium.launch({ headless: true }); 6 const context = await browser.newContext(); 7 const page = await context.newPage(); 8 await page.goto('https://dequeuniversity.com/demo/mars/'); 9 10 try { 11 const results = await new AxeBuilder({ page }).analyze(); 12 console.log(results); 13 } catch (e) { 14 // do something with the error 15 } 16 17 await browser.close(); 18})();
Constructor for the AxeBuilder helper. You must pass an instance of Playwright as the first argument.
1const builder = new AxeBuilder({ page });
Performs analysis and passes any encountered error and/or the result object.
1new AxeBuilder({ page }) 2 .analyze() 3 .then(results => { 4 console.log(results); 5 }) 6 .catch(e => { 7 // Do something with error 8 });
Adds a CSS selector to the list of elements to include in analysis
1new AxeBuilder({ page }).include('.results-panel');
Method chaining is also available, add multiple CSS selectors to the list of elements to include in analysis
1new AxeBuilder({ page }) 2 .include('.selector-one') 3 .include('.selector-two') 4 .include('.selector-three');
Note: arrays with more than one index when passing multiple CSS selectors are not currently supported example: .include(['#foo', '#bar', '#baz'])
Add a CSS selector to the list of elements to exclude from analysis
1new AxeBuilder({ page }).exclude('.another-element');
Method chaining is also available, add multiple CSS selectors to the list of elements to exclude from analysis
1new AxeBuilder({ page }) 2 .exclude('.selector-one') 3 .exclude('.selector-two') 4 .exclude('.selector-three');
Note: arrays with more than one index when passing multiple CSS selectors are not currently supported example: .exclude(['#foo', '#bar', '#baz'])
Specifies options to be used by axe.run
. Will override any other configured options. including calls to AxeBuilder#withRules()
and AxeBuilder#withTags()
. See axe-core API documentation for information on its structure.
1new AxeBuilder({ page }).options({ checks: { 'valid-lang': ['orcish'] } });
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 AxeBuilder#options
, AxeBuilder#withRules
or AxeBuilder#withRules
will override specified options.
1new AxeBuilder({ page }).withRules('html-lang');
1new AxeBuilder({ page }).withRules(['html-lang', 'image-alt']);
Limits analysis to only those with the specified rule IDs. Accepts a String of a single tag or an Array of multiple tags. Subsequent calls to AxeBuilder#options
, AxeBuilder#withRules
or AxeBuilder#withRules
will override specified options.
1new AxeBuilder({ page }).withTags('wcag2a');
1new AxeBuilder({ 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 AxeBuilder#options
, AxeBuilder#disableRules
will override specified options.
1new AxeBuilder({ page }).disableRules('color-contrast');
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 AxeBuilder({ page }).setLegacyMode(); 2const result = await axe.analyze(); 3axe.setLegacyMode(false); // Disables legacy mode
No vulnerabilities found.
Reason
12 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 10
Reason
security policy file detected
Details
Reason
no binaries found in the repo
Reason
all changesets reviewed
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 5
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
22 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-16
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