Why Anchor Base is more reliable then selectors with indexes?

The UiPath documentation says it is more reliable to use the ‘Anchor Base’ activity if you face a situation where a selector contains indexes as its attributes.

Could anyone explain why it is better? What technology does the ‘Anchor Base’ activity use so we can forget about the indexes and feel better? How does it identify the field which has indexes in its, let’s call it ‘direct’, selector?


The index value comes from the fact that there are multiple elements with an identical selector and the only way to recognize those is by numbering them. But, for example, in the case of few simple input fields you want to be sure to always input your data in the correct one. If you have three input fields and the only difference between them is idx=1, idx=2 and idx=3, the automation will not be reliable. As soon as the application changes, it might be that the first and the second input box switched places, but your bot will keep inputting data into the field marked as idx=1.

The Anchor Base activity is meant to add another point of reference on top of the base selector. It makes the automation bullet proof.

Another way is to indicate an anchor for your selector:

@loginerror Yeah I understand that in the first case it’s not going to be reliable. You mentioned that the Anchor Base activity adds another point of reference. But what special does the activity do to identify the correct field?

Let’s look at your example. We got 3 fields with the idx 1,2,3. I need to type into the 2nd one. I use the Anchor Base activity, use Find Element and then Type into and it somehow chooses the correct field. We point out whether the desired field is located right, left, top, bottom or on top. Does it mean that the Anchor Base activity calculates the distance between the anchor and the desired field given the direction I set? If so then why is it better than using a relative click with coordinates?