Skip to main content

Deque axe Integration


Deque's axe is a world-class digital accessibility toolkit that allows you to integrate functionality into your tests to scan content and generate an a11y score.

Learn how to automate your Web Accessibility tests with LambdaTest and Deque using Webdriver IO framework.

  1. Ensure you have the below dependency for running accessibility tests.
"@axe-core/webdriverio": "4.1.2-alpha.106"
//**or the latest version
  1. The LambdaTest Service, which you probably have in your project.
"@wdio/lambdatest-service"
  1. The next step will be to ensure that our LambdaTest configuration file contains the desired browser configurations and LambdaTest Username and Access Key.
// Specify LambdaTest Username and Access Key.
user: process.env.LT_USERNAME,
key: process.env.LT_ACCESS_KEY,
  1. In the wdio.conf file below, we build an axeWdio object, which then creates a new AxeWebdriverIO instance that uses the current browser (or client) object from WDIO. This injects axe-core into the current page, and when analyze() is invoked, axe-core scans the current page content.
const AxeWebdriverIO = require('@axe-core/webdriverio').default;

before: function (capabilities, specs, browser) {
const axeWdio = new AxeWebdriverIO({
client: browser
})

// Configure Command to run axe
browser.addCommand('getAxeResults', async () => {
return axeWdio.analyze()
.then(async (result) => {


return result
})
.catch(err => {
console.log(err)
})
})

},
  1. Now call the below method in your tests
 browser.getAxeResults()