Class AccessibilityHelper.AccessibilityConfig
java.lang.Object
com.shaft.validation.accessibility.AccessibilityHelper.AccessibilityConfig
- Enclosing class:
AccessibilityHelper
Mutable configuration bean for an accessibility scan with fluent-builder setters.
All setters follow a fluent (builder) pattern and return this,
allowing convenient one-liner configuration:
AccessibilityConfig config = new AccessibilityConfig()
.setTags(List.of("wcag21aa"))
.setContext("main")
.setReportsDir("target/a11y-reports/")
.setIncludePasses(false);
AccessibilityHelper.analyzePageAccessibility(driver, "Home", config);
Default values:
tags–["wcag2a","wcag2aa","wcag21a","wcag21aa","best-practice"]reportsDir–"accessibility-reports/"includePasses–truecontext–"body, header, main, footer"
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a newAccessibilityConfigwith default settings. -
Method Summary
Modifier and TypeMethodDescriptionReturns the CSS selector string used to scope the axe scan to specific page regions.Returns the file-system directory where JSON and HTML reports will be written.getTags()Returns the axe-core WCAG tag filters applied during the scan.booleanReturns whether passing rules are included in the generated report.setContext(String context) Restricts the axe scan to the DOM subtrees matched by the given CSS selector.setIncludePasses(boolean includePasses) Controls whether passing axe rules are written into the report.setReportsDir(String reportsDir) Sets the output directory for generated accessibility reports.Replaces the axe-core tag filters for this scan.
-
Constructor Details
-
AccessibilityConfig
public AccessibilityConfig()Creates a newAccessibilityConfigwith default settings. Use the fluent setters to customise the configuration after construction.
-
-
Method Details
-
getTags
-
setTags
Replaces the axe-core tag filters for this scan.config.setTags(List.of("wcag21aa", "best-practice"));- Parameters:
tags- non-null list of axe rule-set tag identifiers- Returns:
- this instance for method chaining
- Throws:
NullPointerException- iftagsisnull
-
getReportsDir
Returns the file-system directory where JSON and HTML reports will be written.- Returns:
- directory path string (includes trailing
/)
-
setReportsDir
Sets the output directory for generated accessibility reports.config.setReportsDir("target/accessibility/");- Parameters:
reportsDir- path to the output directory; created automatically if absent- Returns:
- this instance for method chaining
-
isIncludePasses
public boolean isIncludePasses()Returns whether passing rules are included in the generated report.- Returns:
trueif passing rules appear in the report;falseotherwise
-
setIncludePasses
Controls whether passing axe rules are written into the report.config.setIncludePasses(false); // omit passes for a leaner report- Parameters:
includePasses-trueto include passing rules;falseto suppress them- Returns:
- this instance for method chaining
-
getContext
Returns the CSS selector string used to scope the axe scan to specific page regions.- Returns:
- CSS selector string (e.g.
"body, header, main, footer")
-
setContext
Restricts the axe scan to the DOM subtrees matched by the given CSS selector.config.setContext("#content, nav");- Parameters:
context- CSS selector identifying the elements to include in the scan- Returns:
- this instance for method chaining
-