axe-devtools-robot API Reference

Link to axe-devtools-robot API Reference copied to clipboard
Not for use with personal data

This library allows axe DevTools to test for accessibility using robot.

Usage

First, import the library in the settings section

*** Settings ***
Library  axe_devtools_robot.AxeRobot

AxeRobot extends the SeleniumLibrary robot package, so all methods available to SeleniumLibrary are available to AxeRobot.

The following keywords are provided:

def analyze(self):
    """Run axe on the page. Fail the test if there are any violations."""
def audit_for_accessibility(self):
    """Run axe on the page. Save the results to `axe-reports directory`. Never fails."
def within(self, *selectors):
    """Specify part of the page to run axe on

    Args:
        selector: List of CSS selectors for elements
    """
def excluding(self, *selectors):
    """Specify part of the page to exclude when runing axe.

    Args:
        selector: List of CSS selectors for elements
    """
def according_to(self, *tags):
    """Specify rules (by tag) to use when running axe.

    List of tags here: https://www.deque.com/axe/core-documentation/api-documentation/#axe-core-tags

    Args:
        tags: List of tags of rules
    """
def according_to_ruleset(self, ruleset, enable_best_practices = False):
    """Use a specific ruleset (i.e. wcag2.1, 508)

    Args:
        ruleset_id: id of the ruleset to use
        enable_best_practices: Whether or not to turn on rules tagged `best-practice`. Default off
    """
def checking_only(self, *rules):
    """Specify rules (by id) to use when running axe.

    List of rules available here: https://dequeuniversity.com/rules/axe/4.1

    Args:
        rules: List of ids of rules
    """
def skipping(self, *rules):
    """Disable some rules when running axe.

    List of rules available here: https://dequeuniversity.com/rules/axe/4.1

    Args:
        rules: List of ids of rules
    """

On the use of 'id' CSS selectors

Robot Framework treats the # character as special. Unless you escape your #s, Robot will interperet 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.