Riferimento API axe-devtools-robot
Not for use with personal data
Questa libreria consente ad axe DevTools di testare l'accessibilità utilizzando robot.
Uso
Per prima cosa, importa la libreria nella sezione impostazioni
*** Settings ***
Library axe_devtools_robot.AxeRobot
AxeRobot
estende il pacchetto robot SeleniumLibrary
, in modo che tutti i metodi disponibili per SeleniumLibrary
siano disponibili per AxeRobot
.
Sono fornite le seguenti parole chiave:
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
"""
Sull'uso dei selettori 'id' CSS
Robot Framework tratta #
il carattere come speciale. A meno che tu non esegui l'escape dei tuoi #
, Robot interpreterà il resto della riga come un commento.
In pratica questo significa che dovrai usare \#
invece di semplicemente #
.
Per maggiori dettagli, consultare la Documentazione del robot .