check_accessibility / my_axe_test.py
rdlf's picture
Create my_axe_test.py
60657be verified
raw
history blame
507 Bytes
from selenium import webdriver
from axe_selenium_python import Axe
def test_google():
driver = webdriver.Chrome()
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"])