2 1 L A B S

How our locators work

21’s locators mechanism is one of our gems. We spent countless hours testing it across applications and various frameworks and made sure it doesn’t fail. Some of the challenges we faced include lack of unique IDs or elements that don’t show in the Object Tree but do appear in the viewport. We also faced applications that include show DOM that doesn’t show on the viewport.
Sophisticated locators

We don’t rely on unique IDs or xPaths

21 takes into account 8 different properties to find objects. All are agnostic to the user, who just points to the element and clicks on it. Under the hood we autonomously look up any of the following unique attributes:

  • Resource ID
  • Class Name
  • Content Description
  • Accessibility ID

If we find unique IDs we store them and use them during execution time.

What happens when there are no IDs or IDs are not unique

We have a number of fallback mechanisms:

Bounds – We calculate the bounds of the element and look for elements with the same bounds.

Position on the screen – We calculate the relative position of the element on the screen.

Both mechanisms includes  a complex system that converts coordinates from one screen resolution to another. Different development frameworks convert differently from one screen resolution to another.

Additional locators

Some elements are two small to covert or might be identical and close to each other. We automatically keep track of the parents, siblings and children assuming one of them would be unique.


Finally in cases were we still can’t find the element we’ll use computer vision to find the element on the viewport, use metadata to find its position and use Tap (x,y) to perform the action. Computer vision adds delay to tests which is why we use it selectively and autonomously when needed.

Start Your 14 Days Free Trail

No Credit card required
Get Started

Stay Tuned

Got a question? Reach out. We’d love to hear from you

Subscribe To Our Newsletter


Connecting testing and production.Autonomously.

California, USA

© Copyrights 2020 21Labs All rights reserved. Made with By 21Labs