axe-devtools-robot API-Referenz
Not for use with personal data
Mit dieser Bibliothek können axe DevTools die Zugänglichkeit mithilfe eines Roboters testen.
Verwendung
Importieren Sie zunächst die Bibliothek im Abschnitt „Einstellungen“
*** Settings ***
Library axe_devtools_robot.AxeRobotAxeRobot erweitert das Roboterpaket SeleniumLibrary , sodass alle für SeleniumLibrary verfügbaren Methoden auch für AxeRobotverfügbar sind.
Die folgenden Schlüsselwörter stehen zur Verfügung:
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
"""Zur Verwendung von „id“-CSS-Selektoren
Robot Framework behandelt das Zeichen # als Sonderzeichen. Sofern Sie Ihre # nicht maskieren, interpretiert Robot den Rest der Zeile als Kommentar.
In der Praxis bedeutet dies, dass Sie \# statt nur # verwenden müssen.
Weitere Einzelheiten finden Sie in der Roboterdokumentation .
