I see that in the modern activities the fuzzy selectors are preferred. Is there a performance difference between strict and fuzzy selectors? Do I invest time to create a good/better strict selector, or go ahead with the fuzzy ones?
Hey @c.ciprian
The preference for fuzzy selectors is often due to their ability to handle dynamic user interfaces, where the elements’ attributes might change based on factors such as screen resolution, font size, or system updates. Fuzzy selectors can be more tolerant of slight changes in the user interface, making them more robust in certain scenarios.
Strict selectors, on the other hand, rely on exact attribute values to identify elements on the screen. While they can work well in stable environments with consistent user interfaces, they may become brittle and fail if there are minor changes to the application’s layout or properties.
Performance-wise, there might be a slight difference between strict and fuzzy selectors, but it’s typically negligible. The real focus should be on reliability and maintainability. If the strict selector can reliably identify elements and the application’s interface is unlikely to change, it can be a viable option. However, if there’s a chance of interface changes or variations, investing time in creating better fuzzy selectors might be more advantageous in the long run.
Fuzzy selectors are more tolerant of changes in element attributes or positions on the screen.
They use partial matching and wildcards to identify elements, allowing for variations in attribute values or dynamic content.
Fuzzy selectors are designed to handle minor changes in the user interface, making automation more resilient to application updates or variations in screen resolutions.
They offer flexibility and can match elements even if some of their attributes change, which can reduce the need for constant selector updates.
However, the flexibility of fuzzy selectors comes with a potential trade-off in specificity. They might be less specific and could inadvertently match unintended elements if not used carefully.
Strict Selector:
Strict selectors use exact attribute values to identify elements on the screen.
They do not tolerate any changes in element attributes, and they must match all specified attributes precisely.
Strict selectors are more specific and less tolerant of changes in the user interface. As a result, they can be more reliable in stable application environments.
Using strict selectors ensures that the automation targets the intended elements with high accuracy, reducing the risk of unintended interactions.
However, strict selectors require more maintenance effort if the application’s user interface undergoes changes.
@c.ciprian
The choice between strict selectors and fuzzy selectors depends on the specific requirements and characteristics of the automation project. Both types of selectors have their merits, and the decision should be based on factors such as the stability of the application, the likelihood of changes in the user interface, and the complexity of the automation.
Here are some considerations to help you decide whether to focus on strict selectors or use fuzzy selectors:
Application Stability: If the target application’s user interface is relatively stable and undergoes infrequent changes, strict selectors can be a good choice. Strict selectors provide precise identification of elements and offer better performance and reliability in such scenarios.
Frequent UI Changes: If the application frequently updates its user interface, or if there are variations in screen resolutions, fuzzy selectors can be more suitable. Fuzzy selectors are more tolerant of minor changes and can handle dynamic content, reducing the need for constant selector updates.
Complexity of UI: In cases where the application’s user interface is complex with nested elements or dynamically generated content, fuzzy selectors might simplify the automation development process. They allow for flexibility in dealing with dynamic elements.
Maintenance Effort: Strict selectors may require more effort to maintain if the application’s UI changes frequently. In contrast, fuzzy selectors might reduce the need for ongoing maintenance due to their adaptability.
Robustness vs. Precision: Strict selectors offer higher precision in identifying elements, which can be crucial for critical and sensitive automations. On the other hand, fuzzy selectors provide greater resilience in handling variations, which is beneficial for less critical tasks.
I always use strict selector when I can (which is most of the time), for two reasons:
strict selector is faster
strict selector is exactly accurate, the element is either found or it isn’t. I don’t want it finding something that’s close, I want it to be exact
The UI elements have stable and unique attributes that rarely change.
Precision is critical, and there should be no room for ambiguity in identifying elements.
The application being automated is unlikely to undergo frequent changes in UI.
Use Fuzzy Selectors When:
The UI elements have dynamic or frequently changing attributes.
The application UI varies across different environments or versions.
You want to create more robust automations that can handle minor UI changes without requiring frequent selector updates.
In modern UiPath development, the preference often leans towards using robust and flexible selectors, which might include a combination of both strict and fuzzy approaches. UiPath Studio has several built-in features, such as UI Explorer and anchor-based selectors, that help create more reliable selectors that are tolerant to changes in the UI. The goal is to create automation processes that can adapt to minor UI variations, reducing the maintenance overhead.
To answer your question crisp…strict are more faster than fuzzy…
Choice depends on situation…as much as possible strict is better so that we dont get wront outcome as well and identifies the elemnt properly
Fuzzy on other hand is suitable when working with modern ui’s where we might expect very less change of getting strict and also the ui changes time to time