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
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
evaluatory
Web page evaluation with a focus on accessibility
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
34,961,992
Last Day
121,352
Last Week
637,717
Last Month
2,703,900
Last Year
22,323,470
MPL-2.0 License
650 Stars
609 Commits
73 Forks
12 Watchers
77 Branches
40 Contributors
Updated on Apr 30, 2025
Minified
Minified + Gzipped
Latest Version
4.10.1
Package Id
@axe-core/playwright@4.10.1
Unpacked Size
61.60 kB
Size
11.92 kB
File Count
8
NPM Version
lerna/8.1.3/node@v18.20.4+x64 (linux)
Node Version
18.20.4
Published on
Nov 11, 2024
Cumulative downloads
Total Downloads
Last Day
50.3%
121,352
Compared to previous day
Last Week
5.4%
637,717
Compared to previous week
Last Month
0.2%
2,703,900
Compared to previous month
Last Year
145.1%
22,323,470
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
all changesets reviewed
Reason
security policy file detected
Details
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
7 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5
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
19 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-05-05
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