Wednesday 8 July 2020

Accessibility scanning using Selenium in C#

While searching for the axe-core engine integration with Selenium C#, I found this very useful library. It is very easy to use as well. You just have to add this nuget package into your project and you will have variety of options to scan the page in a single line of code. The most useful option is, generating the scanned a11y voilation results as email-able html reports. Below is the sample code to scan the page and generate the results as html reports in your desired path.
IWebDriver webDriver = new ChromeDriver();
//navigate to the page to scan
HtmlReport.CreateAxeHtmlReport(webDriver, path);
For more details check the below documentation:

https://troywalshprof.github.io/SeleniumAxeDotnet/#/?id=getting-started