Skip to main content

Cucumber (Java)

Cucumber scenarios still execute ordinary Selenium code under the hood. Enable Accessibility once on the shared WebDriver (usually in a @Before hook), then call lambda-accessibility-scan from step definitions or a small helper when a screen is stable. Behavior matches Selenium Accessibility Automation.

Browsers: Chrome or Edge, supported versions only.

Prerequisites

  • Cucumber JVM + a DI or PicoContainer (or Spring) setup that exposes a singleton WebDriver
  • TestMu AI grid URL and credentials
  • Accessibility entitlement

Onboarding path

1. Create the driver with Accessibility in @Before

@Before(order = 0)
public void setUp() {
MutableCapabilities caps = new MutableCapabilities();
caps.setCapability("browserName", "chrome");
caps.setCapability("accessibility", true);
// caps.setCapability("accessibility.autoscan", true); // optional
driver = new RemoteWebDriver(new URL(HUB_URL), caps);
// inject driver into step defs
}

2. Scan after key navigations

In a step that represents “user is on dashboard” (or after Given/When that loads a URL):

driver.executeScript("lambda-accessibility-scan");

Avoid calling the hook on every tiny interaction; align it with logical pages or states.

3. Optional: auto-scan for exploratory flows

If scenarios bounce across many URLs and you want full coverage without per-step hooks, enable accessibility.autoscan in @Before instead.

4. Run Cucumber and open reports

mvn test -Dcucumber.filter.tags="@smoke"

Dashboard → session → Accessibility tab.

5. CI alignment

Tag scenarios that should run Accessibility (@a11y) so pipelines stay fast; keep capability setup in the shared hook so tagged and untagged runs behave predictably.

Test across 3000+ combinations of browsers, real devices & OS.

Book Demo

Help and Support

Related Articles