Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/axe-selenium-python/axe-selenium-python
aXe Selenium Integration python package
https://github.com/axe-selenium-python/axe-selenium-python
Last synced: about 1 month ago
JSON representation
aXe Selenium Integration python package
- Host: GitHub
- URL: https://github.com/axe-selenium-python/axe-selenium-python
- Owner: axe-selenium-python
- License: mpl-2.0
- Created: 2017-06-12T18:46:51.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2025-01-09T12:41:29.000Z (about 1 month ago)
- Last Synced: 2025-01-09T13:50:30.242Z (about 1 month ago)
- Language: Python
- Homepage: https://pypi.python.org/pypi/axe-selenium-python/
- Size: 894 KB
- Stars: 59
- Watchers: 16
- Forks: 52
- Open Issues: 16
-
Metadata Files:
- Readme: README.rst
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
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].**
.. image:: https://img.shields.io/badge/license-MPL%202.0-blue.svg
:target: https://github.com/axe-selenium-python/axe-selenium-python/blob/master/LICENSE.txt
:alt: License
.. image:: https://img.shields.io/pypi/v/axe-selenium-python.svg
:target: https://pypi.org/project/axe-selenium-python/
:alt: PyPI
.. image:: https://img.shields.io/github/issues-raw/axe-selenium-python/axe-selenium-python.svg
:target: https://github.com/axe-selenium-python/axe-selenium-python/issues
:alt: IssuesRequirements
------------You will need the following prerequisites in order to use axe-selenium-python:
- selenium >= 4.2
- Python 3.12+
- The appropriate driver for the browser you intend to use, downloaded and added to your path, e.g. geckodriver for Firefox:- `geckodriver `_ downloaded and `added to your PATH `_
Installation
------------To install axe-selenium-python:
.. code-block:: bash
$ pip install axe-selenium-python
Usage
------.. code-block:: python
from selenium import webdriver
from axe_selenium_python import Axedef 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.run()
# Write results to file
axe.write_results(results, 'a11y.json')
driver.close()
# Assert no violations are found
assert len(results["violations"]) == 0, axe.report(results["violations"])The method ``axe.run()`` 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.Node dependencies must be installed by running `npm install` inside the axe-selenium-python directory.
You can run the tests using
`tox `_:.. code-block:: bash
$ tox
CHANGELOG
^^^^^^^^^^^^^^version 3.0
***********- Bumped minimum Python version to 3.12
- Updated axe to ``[email protected]``version 2.1.5
*************
**Breaks backwards compatibility**:- The Axe class method ``execute`` has been renamed to ``run`` to mirror the method in the axe-core API.
version 2.1.0
**************
- Created package.json file to maintain axe-core dependency
- Replaced unit tests with more meaningful integration tests
- included a sample html file for integration testsversion 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 to ``[email protected]``
- 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 filesversion 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.28
****************
- Added selenium instance as a class attribute
- Changed file paths to OS independent structure
- Fixed file read operations to use with keywordversion 0.0.21
***************
- Fixed include of aXe API file and references to it
- Updated README