Skip to content

acidburn0zzz/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 axe-core@3.0.3.

License PyPI Travis wheel Issues Updates Python 3

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.

Contributing

Fork the repository and submit PRs with bug fixes and enhancements; contributions are very welcome. You can run the tests using Docker:

$ docker build -t axe-selenium-python .
$ docker run -it axe-selenium-python tox

Resources

About

aXe Selenium Integration python package

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 79.4%
  • Dockerfile 16.3%
  • HTML 4.3%