Writing Tests for axe DevTools for Web for WebDriverIO

Link to Writing Tests for axe DevTools for Web for WebDriverIO copied to clipboard

How to write effective tests for accessibility using axe DevTools for Web for WebDriverIO

Writing tests with axe DevTools


In order to test pages with axe DevTools, you first need it imported and initialized in your project. If you haven't completed this step yet, view this guide on how to do it.

Getting Scan Context

Before you can scan a page for accessibility, it needs to be accessed by WebdriverIO.

await client.url('<URL>');

Once WebdriverIO has accessed the page, you can scan it with axe DevTools and save the results. The most simple way to view the results of the scan is to console log the results object.

const results = await axeDevTools.analyze();

Complete Sample File

const webdriverio = require('webdriverio');
const { AxeDevToolsWebdriverIO } = require('@axe-devtools/webdriverio');

const simpleExample = async () => {
  const client = webdriverio.remote({
    desiredCapabilities: {
      browserName: 'chrome'

  await client.init();
  await client.url('https://google.com');

  const axeDevTools = new AxeDevToolsWebdriverIO({ client });
  const results = await axeDevTools.analyze();
  await client.end();
  return results;

  .then(results => {
  .catch(err => {
    throw err;

Next Steps

Now that you've successfully completed an accessibility scan, you're ready to move on to more advanced scanning topics like generating reports and using the results object.


If you have trouble with getting scan results, contact your Deque representative directly, reach us via our support desk, or send us an email. We'll be happy to help.