Automated web accessibility testing using axe-core engine and Playwright.
- "Automated accessibility audits" - Pamela Fox (North Bay Python 2023)
- Using Python to Fix my Accessibility Night of a Website & Website Accessibility Audit Reports via GH Actions by Jay Miller
- Python >= 3.10
- playwright >= 1.25.0
python3 -m pip install -U axe-playwright-python
python3 -m playwright install --with-deps
from playwright.sync_api import sync_playwright
from axe_playwright_python.sync_playwright import Axe
axe = Axe()
with sync_playwright() as playwright:
browser = playwright.chromium.launch()
page = browser.new_page()
page.goto("https://www.google.com")
results = axe.run(page)
browser.close()
print(f"Found {results.violations_count} violations.")
print(f"Full axe-core response: {results.response}")
For more examples see documentation.
This project is based on axe-core-python by @ruslan-rv-ua and also takes inspiration from axe-selenium-python for output formats.