Skip to main content

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

CHANGELOG

version 2.0.0

  • All functionalities that are not part of axe-core have been moved into a separate package, pytest-axe. This includes: - run_axe helper method - get_rules Axe class method - run Axe class method - impact_included Axe class method - analyze Axe class method.

The purpose of this change is to separate implementations that are specific to the Mozilla Firefox Test Engineering team, and leave the base axe-selenium-python package for a more broad use case. This package was modeled off of Deque’s Java package, axe-selenium-java, and will now more closely mirror it.

All functionalities can still be utilized when using axe-selenium-python in conjunction with pytest-axe.

version 1.2.3

  • Added the analyze method to the Axe class. This method runs accessibility checks, and writes the JSON results to file based on the page URL and the timestamp.

  • Writing results to file can be enabled by setting the environment variable ACCESSIBILITY_REPORTING=true. The files will be written to results/ directory, which must be created if it does not already exist.

  • Accessibility checks can be disabled by setting the environment variable ACCESSIBILITY_DISABLED=true.

version 1.2.1

  • Updated axe.min.js to axe-core@2.6.1

  • Modified impact_included class method to reflect changes to the aXe API:

  • There are now only 3 impact levels: ‘critical’, ‘serious’, and ‘minor’

version 1.0.0

  • Updated usage examples in README

  • Added docstrings to methods lacking documentation

  • Removed unused files

version 0.0.3

  • Added run method to Axe class to simplify the usage in existing test suites

  • run method includes the ability to set what impact level to test for: ‘minor’, ‘moderate’, ‘severe’, ‘critical’

version 0.0.276

  • Added pytest-axe usage example to README

version 0.0.275

  • Added usage example to README

version 0.0.273

  • Added selenium instance as a class attribute

  • Changed file paths to OS independent structure

  • Fixed file read operations to use with keyword

version 0.0.21

  • Fixed include of aXe API file and references to it

  • Updated README

Release files for axe-selenium-python 2.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for axe-selenium-python 2.0.5
File Size Uploaded
axe-selenium-python-2.0.5.tar.gz 74.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for axe-selenium-python 2.0.5
File Interpreter ABI Platform
axe_selenium_python-2.0.5-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 146.9 kB

Release files / axe-selenium-python-2.0.5.tar.gz

Download URL axe-selenium-python-2.0.5.tar.gz
Size 74.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c9498355485e2634489d4486bfff173eae3224d37006056ee3d3a5766466291d
BLAKE2b-256 checksum
How to use checksums
de29895b063b0c26c898bbe1fb96b4593d678b81ce9ca7881c4be60378dd3a0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.8 CPython/3.6.5

Release files / axe_selenium_python-2.0.5-py2.py3-none-any.whl

Download URL axe_selenium_python-2.0.5-py2.py3-none-any.whl
Size 72.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
5cb2aba20b9d1ec91a955a79aa5bb9d75d4ea432fd12d0c868e0317bdd79ffb3
BLAKE2b-256 checksum
How to use checksums
246a9a5ec69f1b45e4302083152b0c55f37e959ff9295b113af145737b77b89d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.8 CPython/3.6.5

Release history Release notifications | RSS feed

3.0.0

2 release files

2.1.6

2 release files

2.1.5

2 release files

2.1.4

2 release files

2.1.3

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

1 release file

2.0.7

2 release files

2.0.6

1 release file

This release

2.0.5 This release

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.2.4

2 release files

1.2.3

1 release file

1.2.2

2 release files

1.2.1

2 release files

1.1.7

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.0.44

2 release files

0.0.43

2 release files

0.0.35

2 release files

0.0.32

2 release files

0.0.31

2 release files

0.0.28

2 release files

0.0.21

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page