Package: selenium-axe-python
selenium-axe-pythonselenium-axe-python integrates aXe and selenium to enable automated web accessibility testing.Originally created asaxe-selenium-pythonbyKimberly Sereduck.
Unfortunately she is no longer assigned to the project which means the original project has gone stale.
This is a fork of that project with some updates.This version of selenium-axe-python is using axe-core@4.8.3RequirementsYou will need the following prerequisites in order to use selenium-axe-python:selenium >= 4.7.0Python 3.8The appropriate driver for the browser you intend to use, downloaded and added to your path, e.g. geckodriver for Firefox:geckodriverdownloaded andadded to your PATHInstallationTo install selenium-axe-python:$pipinstallselenium-axe-pythonUsagefromseleniumimportwebdriverfromselenium_axe_pythonimportAxedeftest_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 jsfileaxe.write_results(results,'a11y.json')driver.close()# Assert no violations are foundassertlen(results["violations"])==0,axe.report(results["violations"])The methodaxe.run()accepts two parameters:contextandoptions.For more information oncontextandoptions, view theaXe documentation here.ContributingYou want to contribute? Great! Here are the things you should do before submitting your PR:Fork the repo and git clone your fork.devinstall the project package:pip install -e .[dev]Optional (poetry users):poetry install --extras devRuntoxto perform tests frequently.Create pull-request from your branch.The original project required you to runnpm install(or in most cases did it at install for you) but this
limited the use of the package to systems that have npm.  This fork includes the latest version of
axe-core.You can run the tests usingtox:$toxAlternatively you can use the makefile in the root of the repo:$makepre-check-inResourcesIssue TrackerCodepytest-axeCHANGELOGversion 2.1.16removed old dependenciesversion 2.1.15updated to work with python >=3.8restricted selenium version to 4.xUpdated axe toaxe-core@4.8.3version 2.1.12forked from original repoaxe-selenium-pythonupdated to work with python >=3.7Updated axe toaxe-core@4.7.2version 2.1.5Breaks backwards compatibility:The Axe class methodexecutehas been renamed torunto mirror the method in the axe-core API.version 2.1.0Created package.json file to maintain axe-core dependencyReplaced unit tests with more meaningful integration testsincluded a sample html file for integration testsversion 2.0.0All functionalities that are not part of axe-core have been moved into a separate package,pytest-axe. This includes:run_axehelper methodget_rulesAxe class methodrunAxe class methodimpact_includedAxe class methodanalyzeAxe class method.The purpose of this change is to separate implementations that are specific to the Mozilla Firefox Test Engineering team,
and leave the baseselenium-axe-pythonpackage 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 usingselenium-axe-pythonin conjunction withpytest-axe.version 1.2.3Added 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 variableACCESSIBILITY_REPORTING=true. The files will be written toresults/directory, which must be created if it does not already exist.Accessibility checks can be disabled by setting the environment variableACCESSIBILITY_DISABLED=true.version 1.2.1Updated axe toaxe-core@2.6.1Modified 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.0Updated usage examples in READMEAdded docstrings to methods lacking documentationRemoved unused filesversion 0.0.3Added run method to Axe class to simplify the usage in existing test suitesrun method includes the ability to set what impact level to test for: 'minor', 'moderate', 'severe', 'critical'version 0.0.28Added selenium instance as a class attributeChanged file paths to OS independent structureFixed file read operations to use with keywordversion 0.0.21Fixed include of aXe API file and references to itUpdated README