axe-devtools-robot API Reference
API reference for the axe-devtools-robot package for Robot Framework-based Python testing
This library allows Axe DevTools to test for accessibility using Robot Framework.
axe_devtools_robot.AxeRobot
Extends SeleniumLibrary, so all keywords available to SeleniumLibrary are also available to AxeRobot.
Import the library in the settings section of your test suite:
*** Settings ***
Library axe_devtools_robot.AxeRobotAnalyze
Run axe-core on the page and fail the test if there are any violations.
Audit For Accessibility
Run axe-core on the page and save the results to the axe-reports directory. Both a .log file (violations report) and a .json file (full results) are written. Never fails.
Within
Specify part of the page for axe-core to analyze.
selectors: One or more CSS selectors for elements to include.
Excluding
Specify part of the page for axe-core to skip during analysis.
selectors: One or more CSS selectors for elements to exclude.
According To
Specify rules (by tag) for axe-core to run.
tags: One or more tag names. See axe-core tags for a list of valid tags.
According To Ruleset
Use a specific ruleset for the axe-core run.
ruleset: ID of the ruleset to use. Available rulesets: wcag2, wcag2.1, wcag2.2, wcag2aaa, wcag2.1aaa, wcag2.2aaa, 508, en301549, ttv5, rgaav4.
enable_best_practices: Whether to enable rules tagged best-practice. Defaults to False.
Checking Only
Specify rules (by ID) for axe-core to run. Only the specified rules are used.
rules: One or more rule IDs. See Rule Descriptions for a list of valid IDs.
Skipping
Disable specific rules from the axe-core run.
rules: One or more rule IDs.
On the use of id CSS selectors
Robot Framework treats the # character as special. Unless you escape your #s, Robot will interpret the rest of the line as a comment.
In practice this means you will have to use \# instead of just #.
See Robot documentation for more details.
Example
*** Settings ***
Library axe_devtools_robot.AxeRobot
Suite Setup Set Log Level DEBUG
*** Test Cases ***
Analyzes
Open Browser http://localhost:8000/example-page.html Chrome
Analyze
Audits
Open Browser http://localhost:8000/example-page.html Chrome
Audit For Accessibility
Uses Within
Open Browser http://localhost:8000/example-page.html Chrome
Within body
Analyze
Close browsers
Close All Browsers