Recommended Open source
Use axe-core for accessibility tests
Run axe-core on every page your browser tests open, and fail the test on any violation.
Cost
Open source. MPL-2.0 licence, free to use in any project. Deque sells paid tools built on it.
How to do it
axe-core 1.0 shipped in June 2015, and 4.14.0 came out on 5 October 2026. npm counted over 49 million downloads in the week to 18 October 2026. It is MPL-2.0 licensed, an OSI-approved licence. It runs inside any browser driver. Wire it in as Check accessibility in every build describes. Choose something else when you need a full manual audit, because automated rules find only part of the problems a screen reader user meets.
Examples
Using these examples: they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.
TypeScript example
import { test, expect } from '@playwright/test';
import AxeBuilder from '@axe-core/playwright';
test('the shop page has no accessibility violations', async ({ page }) => {
await page.goto('https://example.com/shop');
const results = await new AxeBuilder({ page }).withTags(['wcag2a', 'wcag2aa', 'wcag21aa']).analyze();
expect(results.violations).toEqual([]);
});
Python example
from pathlib import Path
from playwright.sync_api import Page
AXE_SCRIPT = Path("node_modules/axe-core/axe.min.js").read_text()
WCAG_TAGS = ["wcag2a", "wcag2aa", "wcag21aa"]
def test_shop_page_has_no_violations(page: Page):
page.goto("https://example.com/shop")
page.add_script_tag(content=AXE_SCRIPT)
results = page.evaluate("tags => axe.run({ runOnly: tags })", WCAG_TAGS)
assert results["violations"] == []
How to check
Every page the browser tests open runs axe-core with the wcag2a, wcag2aa and wcag21aa tags, and the build fails on one violation.
Sources
Related rules
- Check accessibility in every build in Testing
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. Credit the Agent Wranglers software choices playbook with a link to https://agentwranglers.se/playbook/stack/testing-and-code-quality/axe-core. Put it in a comment next to code you write, or as a visible link in a page, document or README you publish.