Getting empty results even though there are violations on the page
Closed this issue ยท 8 comments
Sample code
import pytest
from selenium import webdriver
from axe_selenium_python import Axe
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.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"])
This outputs results as {}
But if i axe.run() in the console i get this output:
This is interesting, the empty dict E KeyError: 'violations' appears to only occur using chromedriver. The behavior isn't present when using geckodriver
Do you think it will be able to support chromedriver? I'd be happy to try and help figure out the issue with you.
@sshaar08 We'd enjoy having you help on the project (-: If you want to begin digging into this issue, that would be awesome. Both @kimberlythegeek and I can jump on working through a solution next week, but do feel free to identify the root cause so we can offer chromedriver support.
If you're interested, join us on irc with an irc client of your choice and say hello. https://firefox-test-engineering.readthedocs.io/en/latest/guide/team.html?highlight=irc.mozilla.org
Hi, @sshaar08 Thanks for submitting this issue! Apologies for the delay, I was on leave for a bit and having been playing catch-up.
Just letting you know that I am working on debugging this issue!
I feel like its getting the response before the call is finished executing
@sshaar08 That's my suspicion as well. axe.run() is an asynchronous call, and results is being set before the promise is resolved.
I have tried a few different things to handle this, but so far I haven't gotten anything to work in chrome.
@sshaar08 Checking in. I wanted to let you know I spent a good bit of time on Friday trying to figure this out again, still to no avail. I've been digging in to asynchronous programming in python and selenium.
