Deque axe™ Integration
Deque's axe™ is one of the world's leading digital accessibility toolkits. The axe-core
library provided by Deque allows you to inject functionality into your tests in order to scan content and return an a11y
score.
Below is a guide to set up the Sauce Labs integration. This integration allows you to run your accessibility tests on our platform with axe™.
Check out the Deque Accessibility Guide for further information.
What You'll Need
- A Sauce Labs account (Log in or sign up for a free trial license)
- A Deque Account (Optional)
Sauce Labs UI
Sauce Labs will display the accessibility results in our UI as a tab in the job itself:
Language Specific Examples
- Java
- JavaScript
- Python
- Ruby
- C#
pom.xml
:<!-- https://mvnrepository.com/artifact/com.deque.html.axe-core/selenium -->
<dependency>
<groupId>com.deque.html.axe-core</groupId>
<artifactId>selenium</artifactId>
<version>4.2.2</version>
</dependency>
new AxeBuilder().analyze(driver);
loading...
-
Install and Set up WebdriverIO.
This documentation shows you how to run a test locally, and also how to troubleshoot potential issues with your code before running on Sauce Labs.
-
Add Sauce Service to WebdriverIO.
-
Add the following dependency to your
package.json
file:
"@axe-core/webdriverio": "4.2.1"
- In the
wdio.conf.js
file, create an object calledaxeWdio
. This object creates a newAxeWebdriverIO
instance which accepts the current browser object from WDIO as an argument.
before: function (capabilities, specs, browser) {
const axeWdio = new AxeWebdriverIO({
client: browser
})
}
- In the
wdio.conf.js
file, add a command for getting basic accessibility results.
browser.addCommand('getAxeResults', function (name) {
return axeWdio.analyze()
})
browser.getAxeResults()
sa11y
library directly:Requirements- Install Sa11y.
pip install sa11y
- Import the
Analyze
class in your file.
from sa11y.analyze import Analyze
Analyze(driver).results()
loading...
sa11y
library directly:Requirements- Add
sa11y
to yourgemfile
:
gem 'sa11y', '~> 0.2.1'
- Require the
Analyze
class in your file:
require 'sa11y/analyze'
Sa11y::Analyze.new(driver).results
loading...
- Install via NuGet, in the Package Manager Console.
Install-Package Selenium.Axe
- Import the namespace.
using Selenium.Axe;
AxeResult axeResult = new AxeBuilder(webDriver).Analyze();
Additional Resources
- Deque Sauce Labs Integration Documentation
- Deque axe DevTools Mobile - for Native Mobile App Testing On Real Devices
- Sauce Bindings Accessibility Feature
- Deque
axe-core
Selenium Integration for Java - Sa11y - Selenium Accessibility for Python & Ruby
- Deque
axe-core
Example WebdriverIO Project - Documentation about the chainable
axe
API for WebdriverIO - Selenium.Axe for .NET