Is there a best practice for creating selectors so they continue to work when a website is updated

We are finding that when using the ui_path selectors that are generated, by indicating an element on the screen, some of the selectors no longer work when the application vendor releases a new version. Is there a standard approach for using anchors or finding elements relative to an element that does not have an id that is changed with a new release?

In our case, the issues of the element id changing in new versions of applications cannot be addressed with “*” or other simple solutions. I am considering using Find Element and Find Relative to deal with this problem, which would be a lot of extra coding/work if most of the selectors need to be created this way.

Just wondering if there is standard way of isolating selectors from the application changes.

3 Likes

Best practices for building good selectors
The hardest part of development is to ensure you have strong selectors in place. Good selectors minimize impacts when the element robot interacts with changes its appearance or position in the screen

Following guidelines helps in building resilient selectors while minimizing the impact when there are changes.

  1. use UiPath Explorer and go through the visual tree to strengthen your variable
  2. use aaname attribute of the selector matching with the visible name or label of the fields
  3. use variables when element name changes dynamically based on data input.
  4. Avoid using class attributes if possible.
  5. DO NOT use css-selectors or any attributes related to the styling of the page (to avoid impact to the bots due to any appearance changes)
  6. DO NOT use idx attribute - this is a dynamic variable and changes depending on the time element loads on the page.
  7. DO NOT use OCR for selectors unless there is no other option.
  8. Use Attach browser or attach window activities to minimize number changes to top-level selectors
  9. use Browser variable input instead of hardcoded selectors in the attach browser activity.
  10. Library for UI Interation of the application: if the application involved frequently changes the UI, consider building the Library and add all the activities which interact with the UI of that application in it.
    this way when there is changes to the UI, you can update the library and reference the new version of it in the dependencies of the UiPath Project using this application.
8 Likes

Thanks for the quick response and great summary for building selectors.

I am proto-typing putting the selectors into a database table, similar to the Library concept you mentioned. That way, if the selectors are changed with a new release, we will only need to update them once for all of the Bots that use that particular application. Just a basic level of abstraction that will take a little more development time for a bot, but will save many hours if the selectors need to be changed.

1 Like

Hello @gary.cook,
as @Amith_Hanumegowda mentioned these are best practices and I would recommend you that you go to UiPath Academy, I am sharing a direct link to that course where best practices for selectors are explained in more details:
https://academy.uipath.com/DirectLaunch?cid=IU2uani8L8k_&io=tgpwv6P5Xm0_&md=IS2TIgXikDA_

You also have an Enhanced Selectors course where you can gain additional knowledge about selectors:
https://academy.uipath.com/DirectLaunch?cid=a4uPRX+6fyo_&io=tgpwv6P5Xm0_&md=IS2TIgXikDA_

Cheers,
Dino

Thanks, I will take a look at the courses.

Gary

136a80e0-04b7-475f-82d7-cd8813d8fef7.png

1 Like