dequelabs / axe-webdriverjs

Provides a chainable axe API for Selenium's WebDriverJS and automatically injects into all frames.
Mozilla Public License 2.0
130 stars 46 forks source link

Violations are not coming in results of Axe execution #48

Closed ariesranjan closed 6 years ago

ariesranjan commented 6 years ago

Hi,

I have written the below code for axe-webdriverjs execution with selenium-webdriver:

var webdriver = require('selenium-webdriver'), By = webdriver.By, until = webdriver.until; var axeBuilder = require('axe-webdriverjs');

var driver = new webdriver.Builder() .forBrowser('chrome') .build();

driver.get('http://www.google.co.uk'); driver.wait(until.titleIs('Google'), 1000) .then(function () { axeBuilder(driver) .withTags(['wcaga']) .analyze(function (results) { console.log('AXE results---------', results); //Analyze FireEyes report errors_axe = results.violations.length; axe_report = results.violations; console.log('axe_report: ', axe_report); console.log('errors_axe: ', errors_axe); }); }); driver.quit();

But I am getting the below result without any violations: { passes: [ { description: 'Ensures every form element has a label', help: 'Form elements must have labels', helpUrl: 'https://dequeuniversity.com/rules/axe/1.1/label', id: 'label', impact: null, nodes: [Object], tags: [Object] } ], timestamp: {}, url: 'https://www.google.co.uk/?gws_rd=ssl', violations: [] }

However, when I run the Axe manually using the browser plugin then I am getting 3 violations. Please help me out what is the reason behind this.

Thanks, Ankit Ranjan

marcysutton commented 6 years ago

Hello, which version of the aXe browser plugin are you using, and which version of axe-webdriverjs? I only get one violation in the Chrome plugin for a missing landmark, and 6 color contrast review items. Make sure the axe-core versions match if you're expecting the same number of violations.

Also, some sites have a Content Security Policy that prevent tools like axe-webdriverjs from running. So you might check the browser instance's developer tools console if you're not getting any results at all.

ariesranjan commented 6 years ago

Hi Marcy,

Thanks for your response! There is no specific version mentioned for aXe browser plugin. However, aXe-devtools version for plugin is 3.2.2 and aXe-core version is 2.6.0 axe-webdriverjs version is 1.2.1 and axe-core version with this I am using is also 2.6.0. If axe-webdriverjs is prevented by Google so I tested using my application for which I want to test the accessibility but still I am getting the violations 0 in the results even though using browser plugin there are violations. See the screenshot for violations I am getting for Google using browser plugin along with the version of plugin. axe_plugin_violations

marcysutton commented 6 years ago

Ah, I figured it out. Your tag is wrong. wcag2a is the correct tag for WCAG 2.0 AA. Refer to our API documentation for all the tags: https://github.com/dequelabs/axe-core/blob/develop/doc/API.md

WilcoFiers commented 6 years ago

Correction: wcag2a is WCAG 2.0 Level A. If you want A and AA, you need wcag2a and wcag2aa both.