Provides a .NET wrapper around axe-core, including a bundled copy of axe-core
and .NET typings for its options and results.
Install a .NET SDK if you haven't already.
Install Deque.AxeCore.Commons
and its dependencies:
dotnet add package Deque.AxeCore.Commons
This package exists primarily to help .NET tool developers integrate axe-core
with different tools and test frameworks. If you are just trying to write test cases using axe-core
, you probably want to use one of these instead:
- Deque.AxeCore.Playwright in combination with Playwright for .NET
- Deque.AxeCore.Selenium in combination with Selenium's C# Selenium.WebDriver package
AxeResult
represents the axe-core Results Object.
AxeRunContext
represents the axe-core Context Parameter.
AxeRunOptions
represents the axe-core Options Parameter.
The IAxeScriptProvider
interface is suitable for use as an option in an API for running an axe-core
scan of a page. It specifies a single method, GetScript()
, which returns a string containing JavaScript code suitable for injecting into a running page.
This library provides two IAxeScriptProvider
implementations:
BundledAxeScriptProvider
provides a bundled copy of axe-core
which is included with the library. The included version will match the major and minor version of the library, but may not match the patch version.
This script provider is suitable as a default option for users that don't wish to explicitly override the version of axe-core
to use.
IAxeScriptProvider axeScriptProvider = new BundledAxeScriptProvider();
axeScriptProvider.GetScript(); // a string containing the contents of the bundled copy of axe.min.js
FileAxeScriptProvider
is an alternate option for users that wish to provide their own separate implementation of axe-core
, usually for the purposes of pinning to a specific axe-core
version independently of this library's version.
new FileAxeScriptProvider("./path/to/axe.min.js");
axeScriptProvider.GetScript(); // synchronously reads the contents of file ./path/to/axe.min.js
This package, including its embedded copy of axe-core, is distributed under the terms of the Mozilla Public License, version 2.0.
This package builds on past work from the SeleniumAxeDotnet and PlaywrightAxeDotnet projects (see NOTICE.txt). We thank all of those projects' contributors for their work.