Analyzes the current page against applied axe rules.

Usage

browser.axeRun('body')

Parameters

Name Type description
selector string

The CSS selector used to locate the element.

options object

Object containing rules configuration to use when performing the analysis

callback
Optional
function

Optional callback function which is called with the results

Example

describe('accessibility testing', function() {

  it('accessibility rule subset', function(browser) {
    browser
      .url('https://www.w3.org/WAI/demos/bad/after/home.html')
      .assert.titleEquals('Welcome to CityLights! [Accessible Home Page]')
      .axeInject()
      .axeRun('body', {
        runOnly: ['color-contrast', 'image-alt'],
      });
  });
})

W3C WebDriver spec