E2E test frameworks
Selenium Java
Getting started

Intro

The a11y-selenium-java is a Java library designed to help you perform accessibility testing on your web pages. Using this tool you can easily run static analysis on a webpage and get a detailed report of accessibility violations based on WCAG guidelines and ACT rules. The library extends Selenium testing framework, making it easy to integrate with your existing testing workflow by using a few lines of code.

// src/test/java/com/example/slenium/e2e/MyE2ETest.java
public class MyE2ETest {
    @Test
    @DisplayName("Basic example")
    void basicExampleTest() {
        var driver = new ChromeDriver();
        driver.get("https://my.site.com");
 
        var analysisConfig = AnalysisConfig.builder().build();
        var auditConfig = AuditConfig.builder()
                .driver(driver)
                .analysisConfiguration(analysisConfig)
                .build();
 
        var statistics = AccessibilityAuditor.userwayAnalysis(auditConfig);
 
        assertThat(statistics.issuesFound()).isLessThan(10);
    }
}

Prerequisites

Selenium 4.0.0 or higher

Distribution

UserWay Selenium Java plugin is distributed as an artifact in Maven Repository

Installation

Add dependency in your pom.xml:

<dependency>
    <groupId>org.userway</groupId>
    <artifactId>a11y-selenium-java</artifactId>
    <version>${userway.selenium.version}</version>
    <scope>test</scope>
</dependency>

Install dependencies

mvn install -Dmaven.test.skip=true

Now you can use static method AccessibilityAuditor#userwayAnalysis(AuditConfig) in your Selenium tests.