File size: 649 Bytes
60657be
 
32f2c94
60657be
32f2c94
60657be
32f2c94
60657be
 
 
 
 
 
463bee7
60657be
 
32f2c94
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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()