Skip to content

SYSTEM Cited by 1 source

axe-core/playwright

@axe-core/playwright is Deque Systems' official binding from Axe Core into Playwright. It ships as an npm package that exposes an AxeBuilder class: a chainable builder that attaches an Axe audit to a Playwright Page.

Surface

The builder API:

import AxeBuilder from '@axe-core/playwright';

const results = await new AxeBuilder({ page })
  .withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'])
  .exclude('.known-accessibility-issue')
  .exclude('.design-exception')
  .analyze();

// results.violations: Violation[]
// results.passes, results.incomplete, results.inapplicable
  • .withTags([...]) — picks the rule-set by tag (see concepts/wcag-2-1-a-aa-scope).
  • .exclude(selector) — omits matched elements from the audit. The primary extension point for two-axis exclusion lists.
  • .include(selector) — restricts audit scope to matched elements (inverse of exclude).
  • .disableRules([...]) / .options({...}) — rule-level and option-level overrides.
  • .analyze() — runs the audit against the current page state; returns the Axe results object.

Integration model

@axe-core/playwright does not bake Axe into Playwright's interaction primitives (clicks, fills, navigations). It is a pull-model audit: the caller invokes .analyze() at a chosen point in the test flow, typically after a view has rendered. This is the load-bearing shape for fixture- extension integrations — the binding gives you a plain function you can wrap in a helper method on a custom Playwright fixture.

Seen in

Last updated · 470 distilled / 1,213 read