id | title | hide_title | sidebar_label | description | keywords | url | site_name | slug | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
selenium-hyprerexecute-accessibility-tests |
Automation Tests with Accessibility Tool using Selenium |
false |
Selenium |
Use LambdaTest Accessibility DevTools to detect and report accessibility issues with automation, following WCAG guidelines, in your selenium tests |
|
LambdaTest |
selenium-hyprerexecute-accessibility-tests/ |
import CodeBlock from '@theme/CodeBlock'; import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/component/keys"; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
<script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify({ "@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [{ "@type": "ListItem", "position": 1, "name": "Home", "item": "https://www.lambdatest.com" },{ "@type": "ListItem", "position": 2, "name": "Support", "item": "https://www.lambdatest.com/support/docs/" },{ "@type": "ListItem", "position": 3, "name": "Cypress Accessibility Testing", "item": "https://www.lambdatest.com/support/docs/selenium-hyprerexecute-accessibility-tests/" }] }) }} ></script>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 <span className="doc__lt" onClick={() => window.openLTChatWidget()}>support team to enable the Accessibility feature for your organization. :::
To run the Tests on HyperExecute from your Local System, you are required:
- HyperExecute YAML file which contains all the necessary instructions.
- HyperExecute CLI in order to initiate a test execution Job .
- Your LambdaTest Username and Access key.
- Setup your local machine as per your testing framework.
You can use your own Selenium project to configure and test it. For demo purposes, we are using the TestNG sample repository.
:::tip Sample repo Download or Clone the code sample for the TestNG from the LambdaTest GitHub repository to run the tests on the HyperExecute.
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:
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.
After cloning / downloading the sample repo, you need to setup the CLI and the environment variables.
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:
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.
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:
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
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
https://github.com/LambdaTest/testng-selenium-hyperexecute-sample/blob/main/yaml/linux/v2/testng_hyperexecute_autosplit_sample.yaml
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 Preferences → Security & Privacy → General 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.
Visit the HyperExecute Dashboard and check your Job status.
<img loading="lazy" src={require('../assets/images/accessibility-testing/hyp-selenium.gif').default} alt="automation-dashboard" className="doc_img"/>