Web Page Accessibility and How to Test it manually and through Test Automation

QA Talks Community
10 min readMay 5, 2021



Post-Pandemic the dependencies on The digital world has been increased a lot. Many Websites and App helped people working from home and get everything Home to deliver. But What about people with Disabilities. How do they access the digital content? Then I come across the term Accessibility, how it works. Being from a Testing background, I decided to check how to do Accessibility Testing. I did a simple POC and thought to share my knowledge with you.

Web Accessibility, what is it:

Accessibility is a term that describes how something can be accessible by the less privileged (People with visual/hearing/mobility/cognitive impairments) person in the same manner as a normal person can access. Now, what is Web Accessibility? This is a term that describes that a web page must be developed in such a manner which can be accessed by People with visual/hearing/mobility/cognitive impairments without any difficulty like normal people.

How does Web Accessibility Work:

When a browser loads a Webpage, basically it reads the HTML/CSS page and traverses through the DOM (Document Object Model) tree. It not only reads the DOM tree but fixes any kind of error present in the DOM tree via DOM API using JavaScript and form another tree called Accessibility tree. The DOM tree and Accessibility are similar yet different. The nodes within this tree will have the same data, but each object holds rich semantic data. As per https://www.w3.org/TR/wai-aria-1.2, WAI-ARIA(Web Accessibility Initiative — Accessible Rich Internet Applications) is intended to augment semantics in supporting languages like [HTML] and [SVG2], or to be used as an accessibility enhancement technology in other mark-up-based languages that do not explicitly include support for ARIA. It clarifies semantics to assistive technologies when authors create new types of objects, via style and script. In layman term, it basically provides the ability to modify and enhance the semantic meaning of an element in DOM through ARIA attributes.

Accessibility Tree = DOM + ARIA

The browser read the Accessibility tree via different Accessibility API and send this information to different assistive technology like Screen Reader which reads the web page. Similarly, when a differently-abled person clicked on any control on the web page, the screen reader interprets it and send the information via Accessibility API to accessibilityPerformPress() function is Accessibility Tree for the element in focus, which further pass the information to JavaScript for a click event()/submit() via DOM API and that sends the information to the server via Rest API and based on the server response perform the actions through JavaScript.

WCAG Guidelines:

All the Webpage Accessibility follows the guidelines provided by https://www.w3.org/WAI/standards-guidelines/wcag/ called Web Content Accessibility Guidelines(WCAG).These guidelines explain how to make web content more accessible to people with disabilities. Web “content” generally refers to the information in a web page or web application, including:

● natural information such as text, images, and sounds

● code or mark-up that defines the structure, presentation, etc.

it has 3 versions as below

● WCAG 2.0 was published on 11 December 2008.

● WCAG 2.1 was published on 5 June 2018.

● WCAG 2.2 is scheduled to be published in 2021.

Accessibility Testing:

To verify the Website is usable by the differently able people and follows the WCAG norm, testing of the Website accessibility need to be performed and this type of testing is called Accessibility Testing.

Why Accessibility Testing should be performed:

Equality: In the world, there are different people there. Some doesn’t have any kind of disability and some people are differently-abled and need special assistance through Web Accessibility to go through the content of the Website and use it as per their need. Those people should be treated equally as a normal person and maintain the digital content in such a manner so that they can access. So, it very important to check if the Website has Web Accessibility or not and follows the WCAG standard or not so that differently-abled people can access it like normal people.

Accessibility Legislation: As per Public Sector Bodies (Websites and Mobile Applications) (№2) Accessibility Regulations 2018, UK, you must make your website or mobile app more accessible by making it ‘perceivable, operable, understandable and robust. You need to include and update an accessibility statement on your website.

Similarly, as per Title III of the Americans with Disabilities Act (ADA), the US prohibits discrimination “on the basis of disability in the activities of public accommodations.” While the law was enacted primarily to focus on obstacles at physical locations, it’s being applied to websites as well.

The European accessibility act covers products and services that have been identified as being most important for persons with disabilities while being most likely to have diverging accessibility requirements across EU countries

As per 1.8 Accessibility | Guidelines For Indian Government Websites, To implement the Convention India has enacted the Rights of Persons With Disabilities Act, 2016 on 27th December 2016. With regard to ICT, one of the important provisions in the act is that all contents available in audio, print and electronic media must be the inaccessible format.

According to The Accessible Canada Act (Bill C-81), One of the purposes of the act is to prevent accessibility barriers in information and communication technologies, including digital content and the technologies used to access it. Requirements of this act, including web accessibility, will likely follow WCAG. Organizations under federal jurisdiction are required to comply or face a fine of up to $250,000.

So Almost all countries of the World Accessibility Legislation and to avoid any kind of Legal issue its important to test the Website is accessible to the people with disability and is developed as per WCAG standards.

Business Promotions: After the pandemic, the importance of digitalization is felt more than previous as getting everything at home delivered is no more luxury but a necessity now. More people access these commercial websites more is sales. And many times, certain products are sold only for disabled people. If a person with a disability can access the websites, the likelihood of buying the product these days is very less. So, it’s important to test the website to check if all commercial websites are accessible by differently-abled people and they can buy products from the websites like normal persons.

Web Accessibility Testing Checklist:

Now that we know how important web accessibility testing is, one should know How to Test Web Accessibility. If we look at the previous figure, Web accessibility is getting possible by

● Accessibility Tree

● Accessibility API

● Assistive Technologies

So, when we are testing web accessibility, we need to check

● The accessible tree is created as per WCAG standard

● Accessibility APIs are transferring responses properly

● Assistive technology tools are matching the Accessibility Tree requirements.

The Detail checklist of Web Accessibility can be found below

❖ Compatible Keyboard Operation support: Verify the All the KeyBoard operation can be performed by a differently-abled person as per the VoiceOver speech or as per the requirements conveniently

❖ Screen Reader: Screen reader should read the web content accurately so that one can interact with the website properly.

❖ Image: Each Image should be described properly by alt Text so that the screen reader can read it. All image colours are read properly from the Accessibility Tree.

❖ Zoom Ability: Upon zooming the webpage the content should be readable by the Screen reader and UI should not be damaged due to zoom and is visible within the screen.

❖ UI: UI should be as per WCAG standard and Font and Background colour should be accessible to the differently-abled person.

❖ ARIA Attributes: All the ARIA attributes are provided properly so that the Screen content is properly accessible.

❖ CSS: CSS Styles should be proper so that it is correctly accessible by everyone.

How to test Webpage Accessibility:

Since we know now what we need to test when we perform Accessibility testing, we should know how to test Web Accessibility.

Web Accessibility can be tested by

⮚ Manual Testing

⮚ Automation Testing

There are multiple tools are available for Web Accessibility testing. Few popular tools are

● WAVE Evaluation Tool

● WCAG Accessibility Audit Developer UI

● Tennon

● Deque Axe

● Dynomapper.com


● Accessibility Checker

Out of all these let's pick up an Open Source tool and see the Report.

How to test manually the Web Accessibility using WAVE Evaluation Tool:

  1. Navigate to https://wave.webaim.org/ and click on Browser Extension Tab

2. Click on WAVE Chrome Extension at Google Webstore and add the extension to Chrome.

3. Navigate to the Application Under Test(AUT). I am using the mark and spencer URL. And Click Wave Extension.

4. In the Summary report Click on View Details Tab And Click on the Error one after other to see the Error.

Result Analysis:

If you see the above figure, the error says that the alternative Text is missing for the image. It means that the screen reader can’t read the description of the image and a Blind person won’t be able to know about that image.

How to test the Web Accessibility through Automation using Selenium Web driver and Deque Axe library:

One can Automate the Web Accessibility using Deque Axe Library. To add it to your Selenium Web Driver test you need to follow the below step.

1. Add the dependency of Axe Library in POM.xml or Build .gradle.

Dependencies to be added in POM.xml

<groupId> com.deque.html.axe-core</groupId>

Dependencies to be added in build.gradle

compile group: ‘com.deque.html.axe-core’, name: ‘selenium’, version: ‘4.1.2’,changing: true

2. Please refer https://github.com/dequelabs/axe-core-maven-html#readme to add the library to your test.The AxeBuilder type is the main interface. Pass it a Selenium WebDriver instance, configure it, and run the analysis method to get results.options wires a JSON string to axe, allowing rules to be toggled on or off. See the testAccessibilityWithOptions unit test for a sample single-rule execution, and the axe-core API documentation for full documentation on the options object. The run-only option with tags may be of particular interest, allowing the axe to execute all rules with the specified tag(s).include adds to the list of included selectors. If you do not call include at all, the axe will run against the entire document.exclude adds to the list of excluded selectors. Exclusions allow you to focus scope exactly where you need it, ignoring child elements you don’t want to test.with options takes an options object to be passed to the axe. run call.with tags, limits rules run to those that match specified tags.withOnlyRules limits rules run to those specified.disabled rules disables rules.analyze executes axe with any configuration you have previously defined. If you want to test one or more WebElements, you may pass them into analyze instead of using include and exclude.

3. For Sample Code below. Create a Feature File step to Verify Accessibility And Create Step Definition and In-Page Object Create CheckAccessibility Method for using in Verify Accessibility Step Definition. Provide AUT URL in Config/Environment Property File or where ever you pass your properties.

Step Definition


RunTime TestNG Config


In Axe Builder Pass the Driver instance. Please note I have taken a Driver instance in getDriver() method in BasePO Class.

package Hit.pageobjects;import automation.library.reporting.Reporter;
import automation.library.selenium.exec.BasePO;
import com.deque.axe.AXE;
import com.deque.html.axecore.results.Results;
import com.deque.html.axecore.results.Rule;
import com.deque.html.axecore.selenium.AxeBuilder;
import com.deque.html.axecore.selenium.AxeReporter;
import com.deque.html.axecore.selenium.ResultType;
import org.testng.Assert;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.List;
import static com.deque.html.axecore.selenium.AxeReporter.getAxeResultString;
import static com.deque.html.axecore.selenium.AxeReporter.getReadableAxeResults;
public class MarknSpencerLandingPage extends BasePO {public void CheckAccessibility(){
Results results = new AxeBuilder().analyze(getDriver());
List<Rule> violations = results.getViolations();
Reporter.addStepLog(“No Violation found”);
String AxeReportPath = System.getProperty(“user.dir”)+ File.separator + “AxeReports” + File.separator;
String timeStamp = new SimpleDateFormat(“yyyy_MM_dd_HH_mm_ss”).format(new java.util.Date());
String AxeViolationReportPath=AxeReportPath+ “AccessibilityViolations_ “ + timeStamp;
if(getReadableAxeResults(ResultType.Violations.getKey(),getDriver(),violations) ){
AxeReporter.writeResultsToTextFile(AxeViolationReportPath, AxeReporter.getAxeResultString());


Results Analysis: As One can see the hidden Element is focusable. As a result of which Screen reader would read the Hidden Element.


Web Accessibility makes the life of people with disabilities easy and provides them equal opportunity. So the design and testing of Web Accessibility should be done thoroughly.

Author: Sonali Das

More blogs:



QA Talks Community

Welcome to QA Talks, a community-based startup that's mainly focused on QA blogs & talks — https://www.tech-talks.info/