mozilla-services / axe-selenium-python

aXe Selenium Integration python package
https://pypi.python.org/pypi/axe-selenium-python/
Mozilla Public License 2.0
58 stars 50 forks source link

How to capture each occurrence of a violation? #181

Open wendlingd opened 4 years ago

wendlingd commented 4 years ago

Would be much appreciated if this package were to be updated. In the mean time, would there be a way to capture more than one occurrence of each violation? I try to put them into a data frame; something not working.

        problemsInJson = response["violations"] # Grab the JSON of _violations_.
        errorCount = len(problemsInJson)
        if errorCount >= 1:
            for errorRow in problemsInJson:
                currIssue = errorRow['help']
                currHelpUrl = errorRow['helpUrl']
                TagList = errorRow['tags']
                currTags = ', '.join(TagList)
                for node in errorRow['nodes']:
                    currHtmlCode = node['html']
                    TargetList = node['target']
                    currTarget = ', '.join(TargetList)
                resultTable = resultTable.append(pd.DataFrame({'Page': currPage,
                                                               'Issue': currIssue,
                                                               'helpUrl': currHelpUrl,
                                                               'tags': currTags,
                                                               'html': currHtmlCode,
                                                               'target': currTarget}, index=[index + 1]))