diff --git a/csharp-selenium-webdriver-sample/CSharpSeleniumWebdriverSample.csproj b/csharp-selenium-webdriver-sample/CSharpSeleniumWebdriverSample.csproj
index 1fbf8c91..47923de4 100644
--- a/csharp-selenium-webdriver-sample/CSharpSeleniumWebdriverSample.csproj
+++ b/csharp-selenium-webdriver-sample/CSharpSeleniumWebdriverSample.csproj
@@ -15,7 +15,8 @@
-
+
+
diff --git a/csharp-selenium-webdriver-sample/README.md b/csharp-selenium-webdriver-sample/README.md
index 6f393995..9596eb12 100644
--- a/csharp-selenium-webdriver-sample/README.md
+++ b/csharp-selenium-webdriver-sample/README.md
@@ -16,7 +16,7 @@ Some good places to start reading are:
The key tools and libraries this sample demonstrates are:
* [Selenium.WebDriver](https://www.seleniumhq.org), the .NET library for Selenium, a tool for automating interactions with different web browsers.
-* [Selenium.Axe](https://github.com/TroyWalshProf/SeleniumAxeDotnet), a .NET library for running accessibility scans on web pages by using Selenium.WebDriver to run the [axe-core](https://github.com/dequelabs/axe-core) accessibility scanning engine.
+* [Deque.AxeCore.Selenium](https://github.com/dequelabs/axe-core-nuget), a .NET library for running accessibility scans on web pages by using Selenium.WebDriver to run the [axe-core](https://github.com/dequelabs/axe-core) accessibility scanning engine.
* [Azure Pipelines](https://azure.microsoft.com/en-us/services/devops/pipelines/) to run the tests in a CI build with every Pull Request.
This sample also uses a few other tools and libraries which are less important; if you use a different test framework or a different version of .NET, you can still follow along with most of the sample.
@@ -28,7 +28,7 @@ This sample also uses a few other tools and libraries which are less important;
* [Chrome](https://google.com/chrome) (with [Selenium.WebDriver.ChromeDriver](https://github.com/jsakamoto/nupkg-selenium-webdriver-chromedriver/)) and [Firefox](https://www.mozilla.org/firefox/) (with [Selenium.WebDriver.GeckoDriver](https://github.com/jsakamoto/nupkg-selenium-webdriver-geckodriver/)) as our test browsers
* Selenium supports many different browsers and operating systems; use whichever combination is most important for your product!
* [FluentAssertions](https://fluentassertions.com/) to write test assertions
- * We like FluentAssertions because it gives great error messages out-of-the-box with Selenium.Axe. But you can still follow the rest of the sample if you prefer a different assertion style!
+ * We like FluentAssertions because it gives great error messages out-of-the-box with Deque.AxeCore.Selenium. But you can still follow the rest of the sample if you prefer a different assertion style!
## See it in action on your local machine
diff --git a/csharp-selenium-webdriver-sample/SamplePageTests.cs b/csharp-selenium-webdriver-sample/SamplePageTests.cs
index 11b97ae6..e5d2b947 100644
--- a/csharp-selenium-webdriver-sample/SamplePageTests.cs
+++ b/csharp-selenium-webdriver-sample/SamplePageTests.cs
@@ -2,8 +2,9 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// This sample happens to use .NET Core, but you can use whichever .NET version makes sense for your project.
-// Everything we're demonstrating would also work in .NET Framework 4.5+ with no modifications.
+// Everything we're demonstrating would also work in .NET Framework 4.7.1+ with no modifications.
using System;
+using System.Collections.Generic;
using System.IO;
// This sample happens to use MSTest, but you can use whichever test framework you like.
// Everything we're demonstrating would also work with xUnit, NUnit, or any other test framework.
@@ -13,7 +14,8 @@
using OpenQA.Selenium.Support.UI;
// These are the important new libraries we're demonstrating.
// You'll probably need to add new NuGet package references for these.
-using Selenium.Axe;
+using Deque.AxeCore.Commons;
+using Deque.AxeCore.Selenium;
using FluentAssertions;
namespace CSharpSeleniumWebdriverSample
@@ -51,7 +53,6 @@ public void TestAccessibilityOfPage()
// We recommend using FluentAssertions instead; its default behavior gives much better error messages that include
// full descriptions of accessibility issues, including links to detailed guidance at https://dequeuniversity.com
// and CSS selector paths that exactly identify the element on the page with the issue.
- axeResult.Error.Should().BeNull();
// Our PR builds do not change the presence or absence of accessibility issues, so we special case
// our PR build tests to expect the errors. This is not recommended for most projects, but since the
@@ -83,7 +84,6 @@ public void TestAccessibilityOfIndividualElements()
.WithTags("wcag2a", "wcag2aa", "wcag21a", "wcag21aa")
.Analyze(elementUnderTest);
- axeResultWithAnalyzeWebElement.Error.Should().BeNull();
axeResultWithAnalyzeWebElement.Violations.Should().BeEmpty();
// Option 2: using AxeBuilder.Include
@@ -92,11 +92,10 @@ public void TestAccessibilityOfIndividualElements()
AxeResult axeResultWithInclude = new AxeBuilder(_webDriver)
.Include("#id-of-example-accessible-element")
.Include(".class-of-example-accessible-element")
- .Include("#id-of-iframe", "#id-of-element-inside-iframe")
+ .Include(new AxeSelector("#id-of-element-inside-iframe", new List { "#id-of-iframe" }))
.WithTags("wcag2a", "wcag2aa", "wcag21a", "wcag21aa")
.Analyze();
- axeResultWithInclude.Error.Should().BeNull();
axeResultWithInclude.Violations.Should().BeEmpty();
}
@@ -112,8 +111,7 @@ public void TestAccessibilityOfPageExcludingKnownIssues()
AxeResult axeResultExcludingExampleViolationsElement = new AxeBuilder(_webDriver)
.Exclude("#id-of-example-accessibility-violation-list")
.Analyze();
-
- axeResultExcludingExampleViolationsElement.Error.Should().BeNull();
+
axeResultExcludingExampleViolationsElement.Violations.Should().BeEmpty();
// You can also use AxeBuilder.DisableRules to exclude certain individual rules from a scan. This is particularly
@@ -123,14 +121,12 @@ public void TestAccessibilityOfPageExcludingKnownIssues()
.DisableRules("color-contrast", "label", "tabindex")
.Analyze();
- axeResultDisablingRulesViolatedByExamples.Error.Should().BeNull();
axeResultDisablingRulesViolatedByExamples.Violations.Should().BeEmpty();
// Another option is to assert on the size of the Violations array. This works just fine, but we recommend the
// other options above as your first choice instead because when they do find new issues, they will produce error
// messages that more clearly identify exactly what the new/unexpected issues are.
AxeResult axeResult = new AxeBuilder(_webDriver).Analyze();
- axeResult.Error.Should().BeNull();
axeResult.Violations.Should().HaveCount(3);
}
@@ -142,7 +138,7 @@ public void TestAccessibilityOfPageExcludingKnownIssues()
// navigate to a test page.
//
// If you're incorporating accessibility testing into an existing body of end to end tests, you can stick with
- // however your existing tests are already solving this; you don't need to do anything special to use Selenium.Axe.
+ // however your existing tests are already solving this; you don't need to do anything special to use Deque.AxeCore.Selenium.
// Starting a new browser process is good for keeping tests isolated from one another, but can be slow. Here, we're
// using a [ClassInitialize] method so the same browser will be shared between different [TestMethod]s.
@@ -151,12 +147,12 @@ public static void StartBrowser(TestContext testContext) {
// WebDriverFactory uses environment variables set by azure-pipelines.yml to determine which browser to use;
// the test cases we'll write in this file will work regardless of which browser they're running against.
//
- // This WebDriverFactory is just one example of how you might initialize Selenium; if you're adding Selenium.Axe
+ // This WebDriverFactory is just one example of how you might initialize Selenium; if you're adding Deque.AxeCore.Selenium
// to an existing set of end to end tests that already have their own way of initializing a webdriver, you can
// keep using that instead.
_webDriver = WebDriverFactory.CreateFromEnvironmentVariableSettings();
- // You *must* set this timeout to use Selenium.Axe. It defaults to "0 seconds", which isn't enough time for
+ // You *must* set this timeout to use Deque.AxeCore.Selenium. It defaults to "0 seconds", which isn't enough time for
// Axe to scan the page. The exact amount of time will depend on the complexity of the page you're testing.
_webDriver.Manage().Timeouts().AsynchronousJavaScript = TimeSpan.FromSeconds(20);
}