Python library to integrate axe and selenium for web accessibility testing.
Project description
axe-selenium-python
====================
axe-selenium-python integrates aXe and selenium to enable automated web accessibility testing.
.. image:: https://img.shields.io/badge/license-MPL%202.0-blue.svg?style=plastic
:target: https://github.com/kimberlythegeek/axe-selenium-python/blob/master/LICENSE.txt
:alt: License
.. image:: https://img.shields.io/pypi/v/axe-selenium-python.svg?style=plastic
:target: https://pypi.org/project/axe-selenium-python/
:alt: PyPI
.. image:: https://img.shields.io/pypi/wheel/axe-selenium-python.svg?style=plastic
:target: https://pypi.org/project/axe-selenium-python/
:alt: wheel
.. image:: https://img.shields.io/travis/kimberlythegeek/axe-selenium-python.svg?style=plastic
:target: https://travis-ci.org/kimberlythegeek/axe-selenium-python/
:alt: Travis
.. image:: https://img.shields.io/github/issues-raw/kimberlythegeek/axe-selenium-python.svg?style=plastic
:target: https://github.com/kimberlythegeek/axe-selenium-python/issues
:alt: Issues
Requirements
------------
You will need the following prerequisites in order to use axe-selenium-python:
- Python 2.7 or 3.6
- pytest-selenium >= 3.0.0
- `geckodriver <https://github.com/mozilla/geckodriver/releases>`_ downloaded and `added to your PATH <https://stackoverflow.com/questions/40208051/selenium-using-python-geckodriver-executable-needs-to-be-in-path#answer-40208762>`_
Optional
^^^^^^^^
- tox
Installation
------------
To install axe-selenium-python:
.. code-block:: bash
$ pip install axe-selenium-python
To install pytest-axe:
.. code-block:: bash
$ pip install pytest-axe
Usage
------
*test_accessibility.py*
.. code-block:: python
import pytest
@pytest.mark.nondestructive
def test_header_accessibility(selenium, base_url, axe):
selenium.get(base_url)
violations = axe.run('header', None, 'critical')
assert len(violations) == 0, axe.report(violations)
The above example runs aXe against only the content within the *<header>* tag, and filters for violations labeled **critical**.
The method **axe.run()** accepts three parameters: **context**, **options**, and
**impact**.
For more information on **context** and **options**, view the `aXe
documentation here <https://github.com/dequelabs/axe-core/blob/master/doc/API.md#parameters-axerun>`_.
The third parameter, **impact**, allows you to filter violations by their impact
level. The options are **critical**, **severe**, **moderate**, and **minor**, with the
default value set to **None**.
This will filter violations for the impact level specified, and **all violations with a higher impact level**.
To run the above test you will need to specify the browser instance to be invoked, and the **base_url**.
.. code-block:: bash
$ pytest --base-url http://www.mozilla.com --driver Firefox test_accessibility.py
Resources
---------
- `Issue Tracker <http://github.com/kimberlythegeek/axe-selenium-python/issues>`_
- `Code <http://github.com/kimberlythegeek/axe-selenium-python/>`_
- `pytest-axe <http://github.com/kimberlythegeek/pytest-axe/>`_
CHANGELOG
---------
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
====================
axe-selenium-python integrates aXe and selenium to enable automated web accessibility testing.
.. image:: https://img.shields.io/badge/license-MPL%202.0-blue.svg?style=plastic
:target: https://github.com/kimberlythegeek/axe-selenium-python/blob/master/LICENSE.txt
:alt: License
.. image:: https://img.shields.io/pypi/v/axe-selenium-python.svg?style=plastic
:target: https://pypi.org/project/axe-selenium-python/
:alt: PyPI
.. image:: https://img.shields.io/pypi/wheel/axe-selenium-python.svg?style=plastic
:target: https://pypi.org/project/axe-selenium-python/
:alt: wheel
.. image:: https://img.shields.io/travis/kimberlythegeek/axe-selenium-python.svg?style=plastic
:target: https://travis-ci.org/kimberlythegeek/axe-selenium-python/
:alt: Travis
.. image:: https://img.shields.io/github/issues-raw/kimberlythegeek/axe-selenium-python.svg?style=plastic
:target: https://github.com/kimberlythegeek/axe-selenium-python/issues
:alt: Issues
Requirements
------------
You will need the following prerequisites in order to use axe-selenium-python:
- Python 2.7 or 3.6
- pytest-selenium >= 3.0.0
- `geckodriver <https://github.com/mozilla/geckodriver/releases>`_ downloaded and `added to your PATH <https://stackoverflow.com/questions/40208051/selenium-using-python-geckodriver-executable-needs-to-be-in-path#answer-40208762>`_
Optional
^^^^^^^^
- tox
Installation
------------
To install axe-selenium-python:
.. code-block:: bash
$ pip install axe-selenium-python
To install pytest-axe:
.. code-block:: bash
$ pip install pytest-axe
Usage
------
*test_accessibility.py*
.. code-block:: python
import pytest
@pytest.mark.nondestructive
def test_header_accessibility(selenium, base_url, axe):
selenium.get(base_url)
violations = axe.run('header', None, 'critical')
assert len(violations) == 0, axe.report(violations)
The above example runs aXe against only the content within the *<header>* tag, and filters for violations labeled **critical**.
The method **axe.run()** accepts three parameters: **context**, **options**, and
**impact**.
For more information on **context** and **options**, view the `aXe
documentation here <https://github.com/dequelabs/axe-core/blob/master/doc/API.md#parameters-axerun>`_.
The third parameter, **impact**, allows you to filter violations by their impact
level. The options are **critical**, **severe**, **moderate**, and **minor**, with the
default value set to **None**.
This will filter violations for the impact level specified, and **all violations with a higher impact level**.
To run the above test you will need to specify the browser instance to be invoked, and the **base_url**.
.. code-block:: bash
$ pytest --base-url http://www.mozilla.com --driver Firefox test_accessibility.py
Resources
---------
- `Issue Tracker <http://github.com/kimberlythegeek/axe-selenium-python/issues>`_
- `Code <http://github.com/kimberlythegeek/axe-selenium-python/>`_
- `pytest-axe <http://github.com/kimberlythegeek/pytest-axe/>`_
CHANGELOG
---------
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
axe-selenium-python-1.0.0.tar.gz
(64.3 kB
view hashes)
Built Distribution
Close
Hashes for axe-selenium-python-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6233874d3a41aa5dc65f3572097f38a8a133517412aa704e8b03e24a1251a59 |
|
MD5 | 85a0a9379d9d09572e69012c9ecb8640 |
|
BLAKE2b-256 | 6bada90b73f43ccf506e2255f43ca2dce58e07e2676d3df2aa25d31f5ba5c2bd |
Close
Hashes for axe_selenium_python-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02dd6b45eea49c85540639f0aadd7eda54abb7e18db293d9a0816f6cbc4004ff |
|
MD5 | d62c403a711520240283c31f6ae0d882 |
|
BLAKE2b-256 | e40c35687e603f5b7224cd5c96be7ffc27ebb72caafe2e5f4f5d506d3fc8c3e4 |