Python API Overview
Overview of Axe DevTools for Web for Python, including available packages and testing framework integrations
Axe DevTools Python includes:
- axe-core version 4
- Python 3 support (does not support Python 2)
- unittest, robot framework, behave based testing setups, as well as any other framework that uses
asserts
Scans run against WCAG 2.1 Level AA by default, with best-practice and experimental rules turned off. See Customizing Rules to change the ruleset or enable best practices.
Prerequisites
Axe DevTools requires a Selenium WebDriver binding for a browser of your choice. To use Axe DevTools, you must first install and configure Selenium WebDriver.
Description
Axe DevTools is made up of multiple parts. The core package is axe-devtools-api, which provides the logic for configuring and running axe. axe-devtools-selenium is used to allow axe-devtools-api to actually communicate with browsers.
There are three integrations with testing frameworks.
axe-devtools-unittest is a thin assertion library for unittest that sits on top of axe-devtools-api. When using this integration you must declare axe-devtools-api as a dependency and use it directly.
axe-devtools-robot integrates Axe DevTools with the Robot Framework. axe-devtools-api and axe-devtools-selenium are brought in automatically as dependencies. However, you will not interact with either. Instead the integration will make use of your .robot file to operate axe.
axe-devtools-behave integrates Axe DevTools with behave, a cucumber-like testing framework. axe-devtools-api and axe-devtools-selenium are brought in automatically as dependencies. However, you will not interact with either. Instead the integration will make use of your .feature file to operate axe.
Custom Elements and ElementInternals
Starting in Axe DevTools Python 4.13.0, scans read the ARIA semantics that web components declare in JavaScript through ElementInternals, rather than only the role and aria-* attributes present in the markup. No configuration is required. Semantics in the DOM still take precedence: an explicit role or aria-* attribute on the element overrides the value from ElementInternals.
Your components must publish their internals for any of this to take effect, and a component that stores them in a private class field cannot be read. See Testing Custom Elements That Use ElementInternals.
