Concept of Chain Locators 


The essence of end-to-end website testing is finding DOM objects, dealing with them and getting details about the application’s current state. Protractor is one of the most commonly used frameworks for AngularJS applications where locators are used as instructions to show Protractor how to locate the element.

Finding the elements is not a significant challenge since there are many ways to do it, for example, by.css,,, by.model,etc.

Using a single locator to find:

– an element: element(by.css('.myclass’)); 

– a list of elements: element.all(by.css('.myclass’));

Considering that for some subelements of the website we are not always able to identify locators as mentioned above, we have to use the Concept of Chain Locators. This means that you can chain multiple locators to select an element in a complex application, such as:


Chain Locators to Identify Child Elements

This is an overview of a Protractor test in Jasmine, where we have an example of using a chain locator to reach a child element.

describe('Chain locators', function() {  
it('Open Angular js website',function() {
element(by.repeater("resultinmemory")).element(by.css("td:nth-child(3)")).getText().then(function(text) {


“Chaining locators in Protractor” Tech Bite was brought to you by Admira Suljić, Junior Test Engineer at Atlantbh.

Tech Bites are tips, tricks, snippets or explanations about various programming technologies and paradigms, which can help engineers with their everyday job.


Software DevelopmentTech Bites
February 23, 2024

Background Jobs in Elixir – Oban

When and why do we need background jobs? Nowadays, background job processing is indispensable in the world of web development. The need for background jobs stems from the fact that synchronous execution of time-consuming and resource-intensive tasks would heavily impact an application's  performance and user experience.  Even though Elixir is…
QA/Test AutomationTech Bites
December 22, 2023

Selenium Grid 4 with Docker

Introduction When talking about automation testing, one of the first things that comes to mind is Selenium. Selenium is a free, open-source automated testing framework used to validate web applications across different browsers and platforms. It is not just a single tool but a suite of software. Every component of…

Want to discuss this in relation to your project? Get in touch:

Leave a Reply