AxeWatcherDriver Interface
The interface that extends WebDriver to provide accessibility testing capabilities in Selenium Java tests
The AxeWatcherDriver
interface extends the standard Selenium WebDriver
interface to provide access to accessibility testing functionality. This interface is implemented by the proxy drivers created by the AxeWatcher.wrapDriver()
method, enabling access to accessibility testing controls while maintaining all the standard WebDriver capabilities.
AxeWatcherDriver
serves as the bridge between your Selenium test automation and the axe accessibility testing functionality, giving you access to the AxeWatcherController
which allows you to control when and how accessibility testing occurs.
Interface Definition
Since AxeWatcherDriver
is an interface, it doesn't have constructors. Instead, you obtain an implementation when you wrap a WebDriver with the AxeWatcher.wrapDriver()
method.
public interface AxeWatcherDriver extends WebDriver {
AxeWatcherController axeWatcher();
}
Methods
axeWatcher()
Returns the controller for managing accessibility testing operations. The controller provides methods to start or stop automated analysis, trigger manual analysis, and flush test results.
Returns:
AxeWatcherController
- The controller instance associated with this driver
Example:
// First create and wrap a WebDriver
AxeWatcherOptions options = new AxeWatcherOptions().setApiKey("your-api-key");
AxeWatcher watcher = new AxeWatcher(options);
ChromeOptions chromeOptions = watcher.configure(new ChromeOptions());
ChromeDriver chromeDriver = new ChromeDriver(chromeOptions);
WebDriver driver = watcher.wrapDriver(chromeDriver);
// Now access the controller through the AxeWatcherDriver interface
AxeWatcherController controller = ((AxeWatcherDriver) driver).axeWatcher();
// Use the controller to manage accessibility testing
controller.analyze();