public class AxeBuilder extends Object
| Modifier and Type | Field and Description |
|---|---|
String |
axeRunScript |
String |
hasRunPartialScript |
String |
iframeAllowScriptTemplate |
String |
sameOrigin |
String |
sandboxBusterScript |
String |
unsafeAllOrigins |
| Constructor and Description |
|---|
AxeBuilder()
Initialize an instance of AxeBuilder.
|
AxeBuilder(AxeBuilderOptions builderOptions)
Initialize an instance of AxeBuilder.
|
AxeBuilder(AxeBuilderOptions builderOptions,
com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Initialize an instance of AxeBuilder.
|
| Modifier and Type | Method and Description |
|---|---|
Results |
analyze(org.openqa.selenium.WebDriver webDriver)
Run axe against the entire page.
|
Results |
analyze(org.openqa.selenium.WebDriver webDriver,
boolean injectAxe)
Run axe against the entire page.
|
Results |
analyze(org.openqa.selenium.WebDriver webDriver,
org.openqa.selenium.WebElement... context)
Run axe against a specific WebElement or webElements (including its descendants).
|
AxeBuilder |
disableIframeTesting()
Inject and run axe on the top-level iframe only.
|
AxeBuilder |
disableRules(List<String> rules)
Set the list of rules to skip when running an analysis.
|
AxeBuilder |
exclude(FromFrames fromFrames)
Limit frame testing with the use of `fromFrames`.
|
AxeBuilder |
exclude(FromShadowDom fromShadowDom)
Limit shadow DOM testing with the use of `excludeFromShadowDom`.
|
AxeBuilder |
exclude(List<String> selectors)
Selectors to exclude in the validation.
|
AxeBuilder |
exclude(Object... selector)
Build more complex selectors by combining Shadow DOM and Frame Context to exclude
|
AxeBuilder |
exclude(Object selector)
Build more complex selectors by supplying a single object to exclude
|
AxeBuilder |
exclude(String selector)
Include a single CSS selector to exclude during analysis
|
IAxeScriptProvider |
getAxeScriptProvider()
sets the where we get the axe script from.
|
AxeBuilderOptions |
getDefaultAxeBuilderOptions()
get the default axe builder options.
|
String |
getOptions()
gets the options.
|
AxeBuilder |
include(FromFrames fromFrames)
Limit frame testing with the use of `fromFrames`.
|
AxeBuilder |
include(FromShadowDom fromShadowDom)
Limit shadow DOM testing with the use of `excludeFromShadowDom`.
|
AxeBuilder |
include(List<String> selectors)
Selectors to include in the validation.
|
AxeBuilder |
include(Object... selector)
Build more complex selectors by combining Shadow DOM and Frame Context to include
|
AxeBuilder |
include(Object selector)
Build more complex selectors by supplying a single object to include
|
AxeBuilder |
include(String selector)
Include a single CSS selector to include during analysis
|
AxeBuilder |
setAxeScriptProvider(IAxeScriptProvider axeProvider)
sets the where we get the axe script from.
|
void |
setInjectAxe(Consumer<org.openqa.selenium.WebDriver> cb)
Set a custom method of injecting axe into the page.
|
void |
setInjectAxe(Consumer<org.openqa.selenium.WebDriver> cb,
boolean stillInjectAxe)
Set a custom method of injecting axe into the page.
|
AxeBuilder |
setLegacyMode()
Deprecated.
This method will be removed in v5
|
AxeBuilder |
setLegacyMode(boolean state)
Deprecated.
This method will be removed in v5
|
void |
setOptions(String newOptions)
sets the options.
|
AxeBuilder |
setTimeout(int newTimeout)
sets the timeout.
|
AxeBuilder |
withOnlyRules(List<String> rules)
Limit analysis to only the specified rules.
|
AxeBuilder |
withOptions(AxeRunOptions newRunOptions)
Run configuration data that is passed to axe for scanning the web page.
|
AxeBuilder |
withoutIframeSandboxes()
Remove the "sandbox" attribute from iframes on the page.
|
AxeBuilder |
withOutputFile(String path)
Causes analyze() to write the axe results as a JSON file, in addition to returning it in object
format as usual.
|
AxeBuilder |
withRules(List<String> rules)
Limit analysis to only the specified rules.
|
AxeBuilder |
withTags(List<String> tags)
Limit analysis to only the specified tags.
|
public final String axeRunScript
public final String unsafeAllOrigins
public final String sameOrigin
public final String iframeAllowScriptTemplate
public final String hasRunPartialScript
public final String sandboxBusterScript
public AxeBuilder()
public AxeBuilder(AxeBuilderOptions builderOptions)
builderOptions - Builder optionspublic AxeBuilder(AxeBuilderOptions builderOptions, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
builderOptions - Builder optionsobjectMapper - Mapper to use when converting JSONpublic AxeBuilderOptions getDefaultAxeBuilderOptions()
public AxeBuilder setAxeScriptProvider(IAxeScriptProvider axeProvider)
axeProvider - the source of the axe scriptpublic IAxeScriptProvider getAxeScriptProvider()
public AxeBuilder setTimeout(int newTimeout)
newTimeout - the int value to be setpublic String getOptions()
public void setOptions(String newOptions)
newOptions - the options to be setpublic AxeBuilder withoutIframeSandboxes()
public AxeBuilder disableIframeTesting()
public AxeBuilder withOptions(AxeRunOptions newRunOptions)
newRunOptions - run options to be used for scanning.public AxeBuilder withTags(List<String> tags)
tags - tags to be used for scanningpublic AxeBuilder withOnlyRules(List<String> rules)
rules - rule IDs to be used for scanningpublic AxeBuilder withRules(List<String> rules)
rules - rule IDs to be used for scanningpublic AxeBuilder disableRules(List<String> rules)
rules - rule IDs to be skipped from analysispublic AxeBuilder include(List<String> selectors)
selectors - Any valid CSS selectorspublic AxeBuilder include(String selector)
selector - Arraylist of Stringspublic AxeBuilder include(Object selector)
selector - List of Strings, FromFrames, FromShadowDom objectpublic AxeBuilder include(Object... selector)
selector - Provide a list nested selectorspublic AxeBuilder include(FromFrames fromFrames)
fromFrames - List of specific sections within a frame to includepublic AxeBuilder include(FromShadowDom fromShadowDom)
fromShadowDom - List of shadow DOM host element(s) to includepublic AxeBuilder exclude(List<String> selectors)
selectors - Any valid CSS selectorspublic AxeBuilder exclude(String selector)
selector - Arraylist of Stringspublic AxeBuilder exclude(Object selector)
selector - List of Strings, FromFrames, FromShadowDom objectpublic AxeBuilder exclude(Object... selector)
selector - Provide a list nested selectorspublic AxeBuilder exclude(FromFrames fromFrames)
fromFrames - List of specific sections within a frame to excludepublic AxeBuilder exclude(FromShadowDom fromShadowDom)
fromShadowDom - List of shadow DOM host element(s) to excludepublic AxeBuilder withOutputFile(String path)
path - Path to the output file. Will be passed as-is to the System.IO APIs.@Deprecated public AxeBuilder setLegacyMode()
@Deprecated public AxeBuilder setLegacyMode(boolean state)
state - Whether or not to use legacy mode.public void setInjectAxe(Consumer<org.openqa.selenium.WebDriver> cb)
cb - function that will inject axe-core into the pagepublic void setInjectAxe(Consumer<org.openqa.selenium.WebDriver> cb, boolean stillInjectAxe)
cb - function that will inject axe-core into the pagestillInjectAxe - whether or not to still inject axepublic Results analyze(org.openqa.selenium.WebDriver webDriver, org.openqa.selenium.WebElement... context)
webDriver - for the page to be scannedcontext - WebElement(s) to testpublic Results analyze(org.openqa.selenium.WebDriver webDriver)
webDriver - for the page to be scannedpublic Results analyze(org.openqa.selenium.WebDriver webDriver, boolean injectAxe)
webDriver - for the page to be scannedinjectAxe - whether or not to inject axe into the pageCopyright © 2023. All rights reserved.