Back to Webdriverio

Axe Core

website/docs/accessibility-testing/AxeCore.md

9.28.01.1 KB
Original Source

You can include accessibility tests within your WebdriverIO test suite using the open-source accessibility tools from Deque called Axe. The setup is very easy, all you need to do is to install the WebdriverIO Axe adapter via:

bash
npm install -g @axe-core/webdriverio

The Axe adapter can be used either in standalone or testrunner mode by simply importing and initializing it with the browser object, e.g.:

ts
import { browser } from '@wdio/globals'
import AxeBuilder from '@axe-core/webdriverio'

describe('Accessibility Test', () => {
    it('should get the accessibility results from a page', async () => {
        const builder = new AxeBuilder({ client: browser })

        await browser.url('https://testingbot.com')
        const result = await builder.analyze()
        console.log('Acessibility Results:', result)
    })
})

You can find more documentation on the Axe WebdriverIO adapter on GitHub.