![]() |
VOOZH | about |
dotnet add package Deque.AxeCore.Playwright --version 4.11.3
NuGet\Install-Package Deque.AxeCore.Playwright -Version 4.11.3
<PackageReference Include="Deque.AxeCore.Playwright" Version="4.11.3" />
<PackageVersion Include="Deque.AxeCore.Playwright" Version="4.11.3" />Directory.Packages.props
<PackageReference Include="Deque.AxeCore.Playwright" />Project file
paket add Deque.AxeCore.Playwright --version 4.11.3
#r "nuget: Deque.AxeCore.Playwright, 4.11.3"
#:package Deque.AxeCore.Playwright@4.11.3
#addin nuget:?package=Deque.AxeCore.Playwright&version=4.11.3Install as a Cake Addin
#tool nuget:?package=Deque.AxeCore.Playwright&version=4.11.3Install as a Cake Tool
👁 Deque.AxeCore.Playwright NuGet package
👁 NuGet package download counter
Automated web accessibility testing with .NET, C#, and Playwright. Wraps the axe-core accessibility scanning engine and the Playwright browser automation framework.
Compatible with .NET Standard 2.1.
This package does not follow Semantic Versioning (SemVer) but instead uses the major and minor version (but not patch version) of axe-core that the package uses. For example, if the API version is v4.7.2, then the axe-core version used by the package will be v4.7.x. The patch version of this package may include bug fixes and new API features but will not introduce breaking changes.
Install via NuGet:
PM> Install-Package Deque.AxeCore.Playwright
# or, use the Visual Studio "Manage NuGet Packages" UI
Ensure you have Playwright browsers installed. For reference, see https://playwright.dev/dotnet/docs/browsers
Example usage with Playwright's NUnit integration:
using System.Threading.Tasks;
using NUnit.Framework;
using Microsoft.Playwright.NUnit;
using Deque.AxeCore.Commons;
using Deque.AxeCore.Playwright;
[TestFixture]
class MyPlaywrightTests : PageTest
{
[Test]
public async Task CheckAxeClean()
{
const string expectedViolationId = "color-contrast";
await Page!.GotoAsync("https://playwright.dev/dotnet");
AxeResult axeResults = await Page!.RunAxe();
Assert.That(axeResults.Violations, Is.Null.Or.Empty);
}
}
This library essentially wraps the axe-core library. Currently the two supported functions are for rule retrieval and for running.
This method retrieves metadata about the rules that axe is capable of running.
IList<AxeRuleMetadata> axeRules = await page.GetAxeRules();
foreach(var rule in axeRules)
{
Console.WriteLine($"Rule name: {rule.RuleId} Help: {rule.Help} HelpUrl: {rule.HelpUrl}");
Console.WriteLine($"Tags: {string.Join(", ", rule.Tags)}");
}
It is also possible to run this only selecting for rules with particular tags. Tags are considered in a disjunctive fashion.
// Only take rules which are wcag2aa or wcag2a.
IList<string> tags = new List<string>() { "wcag2aa", "wcag2a"}
IList<AxeRuleMetadata> axeRules = await page.GetAxeRules(tags);
foreach(var rule in axeRules)
{
Console.WriteLine($"Rule name: {rule.RuleId} Help: {rule.Help} HelpUrl: {rule.HelpUrl}");
Console.WriteLine($"Tags: {string.Join(", ", rule.Tags)}");
}
This method executes the axe.run API, which will run rules against the current state of the page.
AxeResult axeResults = await page.RunAxe();
Console.WriteLine($"Axe ran against {axeResults.Url} on {axeResults.Timestamp}.");
Console.WriteLine($"Rules that failed:");
foreach(var violation in axeResults.Violations)
{
Console.WriteLine($"Rule Id: {violation.Id} Impact: {violation.Impact} HelpUrl: {violation.HelpUrl}.");
foreach(var node in violation.Nodes)
{
Console.WriteLine($"\tViolation found at: {node.Target}");
Console.WriteLine($"\t...with HTML: {node.Html}");
}
}
Console.WriteLine($"Rules that passed successfully:");
foreach(var pass in axeResults.Passes)
{
Console.WriteLine($"Rule Id: {pass.Id} Impact: {pass.Impact} HelpUrl: {pass.HelpUrl}.");
}
Console.WriteLine($"Rules that did not fully run:");
foreach(var incomplete in axeResults.Incomplete)
{
Console.WriteLine($"Rule Id: {incomplete.Id}.");
}
Console.WriteLine($"Rules that were not applicable:");
foreach(var inapplicable in axeResults.Inapplicable)
{
Console.WriteLine($"Rule Id: {inapplicable.Id}.");
}
RunAxe is supported on both Playwright Pages and Playwright Locators. Locators are the easiest way to run axe against only part of a page:
ILocator locator = page.Locator("text=Sign In");
AxeResult axeResults = await locator.RunAxe();
Alternately, when used on a Page, RunAxe supports an AxeRunContext parameter which supports more complex rules for deciding which parts of a page to scan (or exclude from a scan). This corresponds to the axe.run Context parameter:
AxeRunContext runContext = new AxeRunContext()
{
// Only run on this #my-id.
Include = new List<AxeSelector>() { new AxeSelector("#my-id") }
};
runContext = new AxeRunContext()
{
// Run on everything except #my-id and #second-id.
Exclude = new List<AxeSelector>()
{
new AxeSelector("#my-id"),
new AxeSelector("#second-id"),
}
};
runContext = new AxeRunContext()
{
// Run on every button except #my-id.
Include = new List<AxeSelector>() { new AxeSelector("button") },
Exclude = new List<AxeSelector>() { new AxeSelector("#my-id") }
};
runContext = new AxeRunContext()
{
// Run on everything, except for #my-id within the iframe #my-frame.
Exclude = new List<AxeSelector>()
{
new AxeSelector("#my-id", new List<string>() { "#my-frame" })
}
};
AxeResult axeResults = await page.RunAxe(runContext);
All RunAxe methods also support an AxeRunOptions parameter.
This corresponds to the axe.run Options parameter.
AxeRunOptions options = new AxeRunOptions()
{
// Run only tags that are wcag2aa.
RunOnly = new RunOnlyOptions { Type = "tag", Values = new List<string> { "wcag2aa" } },
// Specify rules.
Rules = new Dictionary<string, RuleOptions>()
{
// Don't run color-contrast.
{ "color-contrast", new RuleOptions() { Enabled = false } }
},
// Limit result types to Violations.
ResultTypes = new HashSet<ResultType>()
{
ResultType.Violations
},
// Don't return css selectors in results.
Selectors = false,
// Return CSS selector for elements, with all the element's ancestors.
Ancestry = true,
// Don't return xpath selectors for elements.
XPath = false,
// Don't run axe on iframes inside the document.
Iframes = false
};
AxeResult axeResults = await page.RunAxe(options);
axeResults = await page.RunAxe(context, options);
axeResults = await locator.RunAxe(options);
RunAxeLegacySet the frame testing method to "legacy mode". In this mode, axe will not open a blank page in which to aggregate its results. This can be used in an environment where opening a blank page causes issues.
With legacy mode turned on, axe will fall back to its test solution prior to the 4.3 release, but with cross-origin frame testing disabled. The frame-tested rule will report which frames were untested.
Important: Use of .RunAxeLegacy() is a last resort. If you find there is no other solution, please report this as an issue. It will be removed in a future release.
AxeResult axeResults = await page.RunAxeLegacy();
Playwright.Axe (PlaywrightAxeDotnet)This project acts as a drop-in replacement for most of the functionality from Playwright.Axe. (PlaywrightAxeDotnet). To migrate:
.csproj file's <PackageReference> for Playwright.Axe to Deque.AxeCore.Playwright<PackageReference> to Deque.AxeCore.Commons at the same version number as Deque.AxeCore.Playwrightusing Playwright.Axe; statements in your tests to using Deque.AxeCore.Playwright; and/or using Deque.AxeCore.Commons;In a move to standardize, we migrated this package away from Playwright specific typings, instead opting to use the typings from the Deque.AxeCore.Commons package instead. The result is several minor breaking changes that may require updates to your code:
AxeResults has now been renamed to AxeResult; the previously used AxeResult for this package will now be AxeResultItem.AxeNodeResult has been replaced with AxeResultNodeAxeCheckResult has been replaced with AxeResultCheckAxeResultGroup has been replaced with ResultTypeAxeRuleObjectValue has been replaced with RuleOptionsAxeRunOnly has been replaced with RunOnlyOptionsAxeRelatedNode has been replaced with AxeResultRelatedNode. With this type, the Targets property is changed from a IList<string> to a List<AxeResultTarget>; users should expect to modify usages of the Targets property to include a .ToString() method call.AxeRunSerialContext has been replaced by AxeRunContext and AxeSelector types. Here are some examples of how to use the new types:// Finding a single element using the Playwright Locator API.
ILocator locator = page.GetByRole("menu").RunAxe();
// Including/excluding elements in the main frame.
new AxeRunContext()
{
Include = new List<AxeSelector> { new AxeSelector("#foo") },
Exclude = new List<AxeSelector> {},
};
// Including/excluding an element in a child frame.
new AxeRunContext()
{
Include = new List<AxeSelector> { new AxeSelector("#element-in-child-frame", new List<string> { "#iframe-in-main-frame" })},
Exclude = new List<AxeSelector> {},
};
AxeResult changed from System.DateTime to System.DateTimeOffsetAxeResult changed from Uri to stringOrientationAngle type in AxeTestEnvironment changed from int to doubleHelpUrl in AxeResultItem changed from Uri to stringAxeEnvironmentData interface and using the existing environment data info in Deque.AxeCore.Commons.AxeResultAxeImpactValue and AxeRunOnlyType enums in favor of using string in the Commons typings (AxeResultItem.cs and AxeRunOptions.cs, respectively)FailureSummary was removed from AxeResultNode (formerly AxeNodeResult)ElementRef and PerformanceTimer were removed from AxeRunOptionsAxeRunOptions and RunOnlyOptions now use named object-initializer syntax instead of constructor parameters.Refer to the general .
This package is distributed under the terms of the .
However, note that it has a dependency on the () Deque.AxeCore.Commons NuGet package.
This package builds on past work from the PlaywrightAxeDotnet project (see ). We @IsaacWalker for his work on that project.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 netstandard2.1 is compatible. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 2 NuGet packages that depend on Deque.AxeCore.Playwright:
| Package | Downloads |
|---|---|
|
GingerCoreNET
Package Description |
|
|
Umbraco.Community.uAccessible
Accessibility audit reports for your Umbraco content pages, directly in the backoffice. |
Showing the top 2 popular GitHub repositories that depend on Deque.AxeCore.Playwright:
| Repository | Stars |
|---|---|
|
Keboo/DotnetTemplates
A repository for my dotnet templates
|
|
|
Ginger-Automation/Ginger
Ginger Automation IDE
|
| Version | Downloads | Last Updated |
|---|---|---|
| 4.11.3 | 16,225 | 5/5/2026 |
| 4.11.3-alpha.127 | 55 | 6/16/2026 |
| 4.11.3-alpha.120 | 53 | 5/21/2026 |
| 4.11.3-alpha.119 | 52 | 5/20/2026 |
| 4.11.3-alpha.118 | 57 | 5/6/2026 |
| 4.11.3-alpha.117 | 59 | 4/30/2026 |
| 4.11.2 | 12,114 | 4/17/2026 |
| 4.11.2-alpha.116 | 63 | 4/29/2026 |
| 4.11.2-alpha.115 | 56 | 4/29/2026 |
| 4.11.2-alpha.114 | 66 | 4/29/2026 |
| 4.11.2-alpha.113 | 59 | 4/25/2026 |
| 4.11.2-alpha.111 | 59 | 4/17/2026 |
| 4.11.2-alpha.109 | 165 | 4/14/2026 |
| 4.11.1 | 40,137 | 2/3/2026 |
| 4.11.1-alpha.112 | 60 | 4/24/2026 |
| 4.11.1-alpha.108 | 67 | 4/14/2026 |
| 4.11.1-alpha.107 | 66 | 2/3/2026 |
| 4.11.1-alpha.106 | 92 | 1/12/2026 |
| 4.11.0-alpha.105 | 86 | 1/9/2026 |
| 4.11.0-alpha.104 | 190 | 11/4/2025 |