Selector Failure Issue

While creating a automation certain activities fail when selector changes.
Could you please suggest certain ways that could be used to handle such failures.

One thing that i explored was through selenium but it requires session id and port to interact with current browser.

It would help if provided with some relevant information and a solution that could be integrated with UiPath Studio.

Thank you in advance for help!

Hi,

To handle selector changes in UiPath, you can follow some reliable methods.

First, use Anchor-Based Selectors to target elements based on nearby stable elements when the main element’s attributes vary. This way, even if the target’s attributes change, a stable anchor can keep the selector reliable.

Incorporate Wildcards (* or ?) to handle minor, dynamic changes in attributes like id or name. Make your selectors dynamic by using variables for parts that frequently change, like page numbers or timestamps.

With Modern Experience activities, you can leverage Flexible Selectors with anchors and fuzzy matching, making selectors more resilient to small UI changes. For even more control, use Regular Expressions in selectors, which is also available in Modern Experience, to handle specific patterns within dynamic elements.

Wrap critical activities in a Retry Scope to automatically retry if a selector fails due to a transient UI change. Set a sensible timeout to wait for the element to appear if needed.

In UI Explorer, aim to select stable attributes, avoiding dynamic ones like idx unless absolutely necessary. This helps make selectors more robust over time.

If your selectors are unreliable or frequently changing, consider Computer Vision activities to locate elements based on visual recognition, bypassing HTML structures altogether.

My recommendation, for more flexibility in activities like Click, set up optional selectors or fallback strategies. If the robot doesn’t find the selector initially, it can try another method, like switching to Computer Vision or OCR, to ensure it completes the action.

This setup gives you multiple layers of resilience, helping the automation adapt as the UI changes.

Regards,
Kardelen

2 Likes

Thank you Kardelen for your feedback.

Since i was looking for the solution that has to be more generic we cannot use image based techniques since these require certain resolution so when bot has to run on any alloted vm it would fail.

As you mentioned about Retry scope,wildcards,anchor-base selectors these are good approaches but even after implementing these there are failures.

I was looking for a solution that for a pop-up may be lets assume if selector changes we can add its new selector in Try and if it fails in catch block we can find the new selector of the failed element and then through technique like auto-healing we can update our selector.

It will more helpful if the solution is designed in the above mentioned approach.

Thank you in advance for your help!

To achieve this, we could enhance the automation by finding an element with a stable selector and using the Find Children activity to access the child elements defined under this element. This way, the process will dynamically locate other elements based on the reliable selector each time it runs. In this way, we may have created the most suitable rule-based approach. However, for a more advanced “auto-healing” feature, UiPath has been working on and introducing solutions using AI, so in cases like this, we will be able to solve it with AI-powered features.

Regards,
Kardelen

1 Like

@upasna_singla

Welcome to the community

Ideally while choosing selectors it is advised to choose attributes which donot change frequently

if frequent changes are known then better go with cv so that the selectors dont rely on attributes but on values and look of it

cheers

2 Likes

Hi Upasna,

To resolve the selector issue, here are four possible solutions, organized by complexity:

  1. Dynamic Selectors – Use wildcards (* or ?) to handle dynamic elements.
  2. Dynamic Selectors with Anchor Element – Combine wildcards with an anchor element to increase accuracy.
  3. Computer Vision (CV) Screen – Utilize CV for more complex, image-based element detection.
  4. Invoke JavaScript – Leverage JavaScript for advanced custom interactions.

Feel free to choose the option that aligns with your requirements, and let me know if you need any further help.

2 Likes

Hello Ashish,

Thank you for your feedbck!

Could you provide more details about Invoke Javascript option you mentioned.

Thank you in advance for help!

@Anil_G,

When we use the CV activities if the application get updated means the CV activities will fail right??
At that time what’s the solution, do we re indicate the elements or need to use new cv activities to indicate again.
In cv activities we cant re indicate the failed elements.

Thanks in advance!

@naveen.s

we need to update the screen and redo…if there are major changes to screen…in sope you would have option to update

cheers

1 Like

@kardelencihangir,

How to set up the fall back strategy??
Whether in Classic or modern activity??
Can you please elaborate??

Thanks in advance!

Hi Upasna,

Please refer to the following link for detailed information on using the Invoke JS activity in UiPath: Invoke JS Documentation.