Skip to Content
E2E test frameworksSelenium JavaGetting started

Getting started

Intro

The Level CI Selenium Java library enables accessibility testing on your web pages.
It allows you to run static page analysis and generate detailed reports of accessibility violations based on WCAG guidelines and ACT rules.
The library extends the Selenium framework, making it easy to integrate accessibility checks into your existing Java test workflow with just a few lines of code.

// src/test/java/com/example/selenium/e2e/MyE2ETest.java import org.openqa.selenium.chrome.ChromeDriver; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.DisplayName; import static org.assertj.core.api.Assertions.assertThat; import com.levelci.a11y.selenium.*; 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.levelAnalyze(auditConfig); assertThat(statistics.issuesFound()).isLessThan(10); } }

Prerequisites

  • Selenium 4.0.0 or higher
  • Java 11 or higher

Distribution

Level CI Selenium Java plugin is distributed as a Maven artifact.


Installation

Add the dependency to your pom.xml:

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

Install dependencies:

mvn install -Dmaven.test.skip=true

Usage

Once installed, you can call the static method:

AccessibilityAuditor.levelAnalyze(AuditConfig)

in your Selenium tests to perform accessibility analysis.

Last updated on