AxeBuilder

Playwright\Accessibility\AxeBuilder

Fluent builder for configuring and running axe-core accessibility analysis.

$ composer require playwright-php/accessibility

Methods

__construct()

function __construct( private readonly PageInterface $page, )

within()

self

Analyze only a specific part of the page.

function within(string $selector): self

exclude()

self

Exclude specific elements from the analysis.

function exclude(string $selector): self

withTags()

self

Run only rules with specific tags (e.g., 'wcag2a', 'wcag21aa').

function withTags(array $tags): self

withoutRules()

self

Disable specific rules by ID.

function withoutRules(array $rules): self

analyze()

AxeResults

Run the accessibility analysis and return results.

function analyze(): AxeResults