Skip to content

VirdocsSoftware/axe-selenium-python

 
 

Repository files navigation

axe-selenium-python

axe-selenium-python integrates aXe and selenium to enable automated web accessibility testing.

This version of axe-selenium-python is using [email protected].

License PyPI wheel Issues

Requirements

You will need the following prerequisites in order to use axe-selenium-python:

Installation

To install axe-selenium-python:

$ pip install axe-selenium-python

Usage

import pytest
 from selenium import webdriver
 from axe_selenium_python import Axe

 def test_google():
     driver = webdriver.Firefox()
     driver.get("http://www.google.com")
     axe = Axe(driver)
     # Inject axe-core javascript into page.
     axe.inject()
     # Run axe accessibility checks.
     results = axe.execute()
     # Write results to file
     axe.write_results('a11y.json', results)
     driver.close()
     # Assert no violations are found
     assert len(results["violations"]) == 0, axe.report(results["violations"])

The method axe.execute() accepts two parameters: context and options.

For more information on context and options, view the aXe documentation here.

Resources

Packages

No packages published

Languages

  • Python 84.0%
  • Dockerfile 16.0%