check_accessibility / my_axe_test.py
rdlf's picture
Update my_axe_test.py
463bee7 verified
raw
history blame
649 Bytes
from selenium import webdriver
from axe_selenium_python import Axe
import gradio as gr
def test_url(url):
driver = webdriver.Chrome()
driver.get(url)
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"])
print (results)
demo = gr.Interface(fn=test_url, inputs="text", outputs="text", title="Comprobaci贸n de accesibilidad")
demo.launch()