Skip to main content

Automation Tests with Accessibility Tool using Selenium

This document provides a detailed, step-by-step way to execute your accessibility tests using LambdaTest's Accessibility Tool on HyperExecute.

note

This documentation is applicable for all supported languages for Selenium framework.

Please reach out to our support team to enable the Accessibility feature for your organization.

Prerequisites

To run the Tests on HyperExecute from your Local System, you are required:

Step-by-Step Guide to Trigger Your Test

Step 1: Configure Your Test Suite

You can use your own Selenium project to configure and test it. For demo purposes, we are using the TestNG sample repository.

Sample repo

Download or Clone the code sample for the TestNG from the LambdaTest GitHub repository to run the tests on the HyperExecute.

Image View on GitHub

If you are using your own project, make sure you update the Hub endpoint in your tests file. By setting up the Hub endpoint, you establish the communication channel between your tests and the browser nodes, enabling effective test distribution and execution.

Configure the desired capabilities based on your test requirements. For example:

test.java
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("browserName", "chrome");
capabilities.setCapability("version", "70.0");
capabilities.setCapability("platform", "win10"); // If this cap isn't specified, it will just get the any available one
capabilities.setCapability("build", "LambdaTestSampleApp");
capabilities.setCapability("name", "LambdaTestJavaSample");

You can also use dev and beta browser versions. To generate capabilities for your test requirements, you can use our inbuilt 🔗 Capabilities Generator Tool.

Step 2: Setup the CLI in your Test Suite

After cloning / downloading the sample repo, you need to setup the CLI and the environment variables.

Download the HyperExecute CLI

The CLI is used for triggering the tests on HyperExecute. It is recommend to download the CLI binary on the host system and keep it in the root directory of the suite to perform the tests on HyperExecute.

You can download the CLI for your desired platform from the below mentioned links:

PlatformHyperExecute CLI
Windowshttps://downloads.lambdatest.com/hyperexecute/windows/hyperexecute.exe
MacOShttps://downloads.lambdatest.com/hyperexecute/darwin/hyperexecute
Linuxhttps://downloads.lambdatest.com/hyperexecute/linux/hyperexecute

Setup Environment Variable

Now, you need to export your environment variables LT_USERNAME and LT_ACCESS_KEY that are available in the LambdaTest Profile page.

Run the below mentioned commands in your terminal to setup the CLI and the environment variables.

export LT_USERNAME="undefined"
export LT_ACCESS_KEY="undefined"

Step 3: Add the Capabilities to enable the Accessibility

To generate the accessibility reports, add a capability accessibility: true in your test files. You can also define some advanced capabilities like accessibility.wcagVersion, accessibility.bestPractice, and accessibility.needsReview as shown below:

test.java
capabilities.setCapability("accessibility", true); // Enable accessibility testing
capabilities.setCapability("accessibility.wcagVersion", "wcag21a"); // Specify WCAG version (e.g., WCAG 2.1 Level A)
capabilities.setCapability("accessibility.bestPractice", false); // Exclude best practice issues from results
capabilities.setCapability("accessibility.needsReview", true); // Include issues that need review

Step 4: Configure your YAML file

Configure your YAML file as per your use cases using key value pairs. In this sample YAML file, we have mentioned:

  • version of the YAML file
  • Timeouts for executing your project
  • Mode of execution is Autosplit. You can also opt for Matrix or Hybrid mode.
  • Pre and Post commands
  • Reports and Artefacts that will be generated after the completion of tests
  • and other necessary YAML Parameters
HyperExecute AutoSplit YAML
loading...

Step 5: Execute your Test Suite

NOTE : In case of MacOS, if you get a permission denied warning while executing CLI, simply run chmod u+x ./hyperexecute to allow permission. In case you get a security popup, allow it from your System PreferencesSecurity & PrivacyGeneral tab.

Run the below command in your terminal at the root folder of the project:

./hyperexecute --config RELATIVE_PATH_OF_YOUR_YAML_FILE

OR use this command if you have not exported your username and access key in the step 2.

./hyperexecute --user undefined --key undefined --config RELATIVE_PATH_OF_YOUR_YAML_FILE 

Step 6: Monitor the Test Execution

Visit the HyperExecute Dashboard and check your Job status.

automation-dashboard

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

Book Demo

Help and Support

Related Articles