axe DevTools Selenium
The axe-devtools-selenium
gem provides a chainable axe API for the Selenium WebDriver and automatically injects it 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-selenium gem:
- Add
axe-devtools-selenium
to your Gemfile or gemspec file and runbundle install
.
gem "axe-devtools-selenium"
spec.add_dependency "axe-devtools-selenium"
- Require the gem and configure.
require 'axe-devtools-selenium'
# configure `AxeSelenium`
driver = AxeSelenium.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
AxeSelenium.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 selenium-webdriver
. The valid browser names are:
:firefox
(default):chrome
:safari
note
Please ensure respective drivers (eg: geckodriver
) are installed in 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 take parameters for advanced AxeDevTools
configuration