Coder Social home page Coder Social logo

matt-l-w / axe-selenium-python Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mozilla-services/axe-selenium-python

0.0 1.0 0.0 211 KB

aXe Selenium Integration python package

Home Page: https://pypi.python.org/pypi/axe-selenium-python/

License: Mozilla Public License 2.0

Python 94.84% HTML 5.16%

axe-selenium-python's Introduction

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/mozilla-services/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/travis/mozilla-services/axe-selenium-python.svg
   :target: https://travis-ci.org/mozilla-services/axe-selenium-python
   :alt: Travis
.. image:: https://img.shields.io/github/issues-raw/mozilla-services/axe-selenium-python.svg
   :target: https://github.com/mozilla-services/axe-selenium-python/issues
   :alt: Issues
.. image:: https://pyup.io/repos/github/mozilla-services/axe-selenium-python/shield.svg
   :target: https://pyup.io/repos/github/mozilla-services/axe-selenium-python/
   :alt: Updates


Requirements
------------

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

- selenium >= 3.0.0
- Python 2.7 or 3.6
- The appropriate driver for the browser you intend to use, downloaded and added to your path, e.g. geckodriver for Firefox:
  - `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>`_

Installation
------------

To install axe-selenium-python:

.. code-block:: bash

  $ pip install axe-selenium-python


Usage
------

.. code-block:: python

 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 <https://github.com/dequelabs/axe-core/blob/master/doc/API.md#parameters-axerun>`_.

Contributing
------------

Fork the repository and submit PRs with bug fixes and enhancements;
contributions are very welcome. You can run the tests using
`tox <https://tox.readthedocs.io/en/latest/>`_:

.. code-block:: bash

  $ tox

Resources
---------

- `Issue Tracker <http://github.com/mozilla-services/axe-selenium-python/issues>`_
- `Code <http://github.com/mozilla-services/axe-selenium-python/>`_
- `pytest-axe <http://github.com/mozilla-services/pytest-axe/>`_

CHANGELOG
^^^^^^^^^^^^^^

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 tests

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 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 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'

<<<<<<< HEAD
version 0.0.276
****************
- Added pytest-axe usage example to README

version 0.0.275
****************
- Added usage example to README

version 0.0.273
=======
version 0.0.28
>>>>>>> ba24ec56528e4458f0a5604a8d511923c943a479
****************
- 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's People

Contributors

kimberlythegeek avatar pyup-bot avatar stephendonner avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.