Skip to content
This repository was archived by the owner on Dec 7, 2022. It is now read-only.

Commit 00d8606

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents b4911ac + f61fd04 commit 00d8606

28 files changed

Lines changed: 53 additions & 49 deletions

Gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module.exports = function(grunt) {
3232
"summary_detail_level": 3,
3333
"warning_level": "VERBOSE",
3434
"compilation_level": "SIMPLE_OPTIMIZATIONS",
35-
"output_wrapper": "'<%= grunt.file.read('scripts/output_wrapper.txt') %>'",
35+
"output_wrapper": "<%= grunt.file.read('scripts/output_wrapper.txt') %>",
3636
"externs": "./src/js/externs/externs.js"
3737
}
3838
}

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,33 @@ The Accessibility Developer Tools project includes a command line runner for the
7676

7777
The runner will load the specified file or URL in a headless browser, inject axs_testing.js, run the audit and output the report text.
7878

79+
### Run audit from Selenium WebDriver (Scala):
80+
val driver = org.openqa.selenium.firefox.FirefoxDriver //use driver of your choice
81+
val jse = driver.asInstanceOf[JavascriptExecutor]
82+
jse.executeScript(scala.io.Source.fromURL("https://raw.githubusercontent.com/GoogleChrome/" +
83+
"accessibility-developer-tools/stable/dist/js/axs_testing.js").mkString)
84+
val report = js.executeScript("var results = axs.Audit.run();return axs.Audit.createReport(results);")
85+
println(report)
86+
87+
### Run audit from Selenium WebDriver (Scala)(with caching):
88+
val cache = collection.mutable.Map[String, String]()
89+
val driver = org.openqa.selenium.firefox.FirefoxDriver //use driver of your choice
90+
val jse = driver.asInstanceOf[JavascriptExecutor]
91+
def getUrlSource(arg: String): String = cache get arg match {
92+
case Some(result) => result
93+
case None =>
94+
val result: String = scala.io.Source.fromURL(arg).mkString
95+
cache(arg) = result
96+
result
97+
}
98+
jse.executeScript(getUrlSource("https://raw.githubusercontent.com/GoogleChrome/" +
99+
"accessibility-developer-tools/stable/dist/js/axs_testing.js"))
100+
val report = js.executeScript("var results = axs.Audit.run();return axs.Audit.createReport(results);")
101+
println(report)
102+
103+
If println() outputs nothing, check if you need to set DesiredCapabilities for your WebDriver (such as loggingPrefs):
104+
https://code.google.com/p/selenium/wiki/DesiredCapabilities
105+
79106
## Using the results
80107

81108
### Interpreting the result

src/audits/AriaOnReservedElement.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ goog.require('axs.properties');
2222
axs.AuditRules.addRule({
2323
name: 'ariaOnReservedElement',
2424
heading: 'This element does not support ARIA roles, states and properties',
25-
url: 'https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_aria_12--this-element-does-not-support-aria-roles-states-and-properties',
25+
url: 'https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#ax_aria_12',
2626
severity: axs.constants.Severity.WARNING,
2727
relevantElementMatcher: function(element) {
2828
return !axs.properties.canTakeAriaAttributes(element);

src/audits/AriaOwnsDescendant.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ axs.AuditRules.addRule({
2727
// Also: other "bad hierarchy" tests - e.g. active-descendant owning a non-descendant...
2828
name: 'ariaOwnsDescendant',
2929
heading: 'aria-owns should not be used if ownership is implicit in the DOM',
30-
url: 'https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_aria_06--aria-owns-should-not-be-used-if-ownership-is-implicit-in-the-dom',
30+
url: 'https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#ax_aria_06',
3131
severity: axs.constants.Severity.WARNING,
3232
relevantElementMatcher: function(element) {
3333
return axs.browserUtils.matchSelector(element, '[aria-owns]');

src/audits/AriaRoleNotScoped.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ goog.require('axs.utils');
2525
axs.AuditRules.addRule({
2626
name: 'ariaRoleNotScoped',
2727
heading: 'Elements with ARIA roles must be in the correct scope',
28-
url: 'https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_aria_09--elements-with-aria-roles-must-be-in-the-correct-scope',
28+
url: 'https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#ax_aria_09',
2929
severity: axs.constants.Severity.SEVERE,
3030
relevantElementMatcher: function(element) {
3131
return axs.browserUtils.matchSelector(element, '[role]');

src/audits/AudioWithoutControls.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ goog.require('axs.constants.Severity');
2222
axs.AuditRules.addRule({
2323
name: 'audioWithoutControls',
2424
heading: 'Audio elements should have controls',
25-
url: 'https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_audio_01--audio-elements-should-have-controls',
25+
url: 'https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#ax_audio_01',
2626
severity: axs.constants.Severity.WARNING,
2727
relevantElementMatcher: function(element) {
2828
return axs.browserUtils.matchSelector(element, 'audio[autoplay]');

src/audits/BadAriaAttribute.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ goog.require('axs.constants');
3333
var badAriaAttribute = {
3434
name: 'badAriaAttribute',
3535
heading: 'This element has an invalid ARIA attribute',
36-
url: 'https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_aria_11--this-element-has-an-invalid-aria-attribute',
36+
url: 'https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#ax_aria_11',
3737
severity: axs.constants.Severity.WARNING,
3838
relevantElementMatcher: function(element) {
3939
var attributes = element.attributes;

src/audits/BadAriaAttributeValue.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ goog.require('axs.utils');
2323
axs.AuditRules.addRule({
2424
name: 'badAriaAttributeValue',
2525
heading: 'ARIA state and property values must be valid',
26-
url: 'https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_aria_04--aria-state-and-property-values-must-be-valid',
26+
url: 'https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#ax_aria_04',
2727
severity: axs.constants.Severity.SEVERE,
2828
relevantElementMatcher: function(element) {
2929
var selector = axs.utils.getSelectorForAriaProperties(axs.constants.ARIA_PROPERTIES);

src/audits/BadAriaRole.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ goog.require('axs.utils');
2323
axs.AuditRules.addRule({
2424
name: 'badAriaRole',
2525
heading: 'Elements with ARIA roles must use a valid, non-abstract ARIA role',
26-
url: 'https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_aria_01--elements-with-aria-roles-must-use-a-valid-non-abstract-aria-role',
26+
url: 'https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#ax_aria_01',
2727
severity: axs.constants.Severity.SEVERE,
2828
relevantElementMatcher: function(element) {
2929
return axs.browserUtils.matchSelector(element, '[role]');

src/audits/ControlsWithoutLabel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ goog.require('axs.utils');
2323
axs.AuditRules.addRule({
2424
name: 'controlsWithoutLabel',
2525
heading: 'Controls and media elements should have labels',
26-
url: 'https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_text_01--controls-and-media-elements-should-have-labels',
26+
url: 'https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#ax_text_01',
2727
severity: axs.constants.Severity.SEVERE,
2828
relevantElementMatcher: function(element) {
2929
var controlsSelector = ['input:not([type="hidden"]):not([disabled])',

0 commit comments

Comments
 (0)