Usage with Playwright
Playwright is a cross-browser end-to-end testing framework from Microsoft, driving real Chromium, Firefox, and WebKit engines from Node.js. surea11y integrates through the @surea11y/playwright binding.
$ npm install @surea11y/playwright playwright$ npx playwright install chromium
The second command matters — every test launches a real browser, and npm install alone doesn't fetch it.
const { chromium } = require('playwright');const { A11yCoreBuilder } = require('@surea11y/playwright');const browser = await chromium.launch();const page = await browser.newPage();await page.goto('https://example.com/');const results = await new A11yCoreBuilder({ page }).include('#main') // optional -- call multiple times for multi-region scans.exclude('.cookie-banner') // optional.withTags(['wcag2a', 'wcag2aa']).disableRules(['meta-refresh-no-exceptions']).analyze();console.log(results.checksResults.filter(r => r.outcome === 'fail'));await browser.close();
Works against all three Playwright engines, not just Chromium — verified with real Firefox and WebKit runs.
Also see a runnable example in the package's own repo.
Next: choose which rules run, integrate the scan into CI, and review the full result schema.