axe DevTools Watir

Link to axe DevTools Watir copied to clipboard

The axe-devtools-watir gem provides a chainable axe API for Watir and automatically injects into all frames.

Setup and Usage

Ensure you have access to Deque's registry. If not, refer to the setup documentation.

Follow the steps below to set up the axe-devtools-watir gem:

  • Add axe-devtools-watir to your Gemfile or gemspec file and run bundle install.
gem "axe-devtools-watir"
spec.add_dependency "axe-devtools-watir"
  • Require the gem and configure.
require 'axe-devtools-watir'

# configure `AxeWatir`
driver = AxeWatir.configure(:firefox) do |c|
  # see below for a full list of configurations
  c.jslib_path = "next-version/axe.js"
end

# use the driver configuration instance
driver.page.navigate.to 'https://www.deque.com/'

API

AxeWatir.configure

The configure method takes one optional argument as a symbol and a configuration block object: configure(*arg, &block)

The optional argument is a browser name for watir. The valid browser names are:

  • :firefox
  • :chrome (default)
  • :safari
  • :internet_explorer
  • :edge
note

Please ensure the necessary drivers (eg: geckodriver) are installed on your machine.

The block configuration object contains the following properties:

Property Type Description
jslib_path (Optional) String Path to a custom axe source
skip_iframes (Optional) Boolean Indicate if frames should be excluded from injecting with axe

Additionally, the configuration block can also take parameters for advanced AxeDevTools configuration