Speed of execution on selectors

Hi,

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.

Also refer below thread for more information

Hope i helps you!

1 Like

Hi @c.ciprian

  1. Strict Selector:
  • A strict selector is more specific and relies on exact property values of the UI elements.
  • It is less prone to breaking when the application’s UI changes since it requires a precise match of the properties.
  • Strict selectors are preferable when dealing with elements that have stable properties and are less likely to change.
  1. Fuzzy Selector:
  • A fuzzy selector is more lenient and allows for variations in the property values of the UI elements.
  • It is useful when the properties of the UI elements are subject to change, but certain identifying characteristics remain consistent.
  • Fuzzy selectors can be used when dealing with dynamic or frequently changing UI elements.

When to Use Each Type:

  • Use a Strict Selector when:
    • The target UI elements have stable properties.
    • The application’s UI structure is unlikely to change frequently.
    • You want to ensure higher accuracy and avoid unintended interactions.
  • Use a Fuzzy Selector when:
    • The target UI elements have properties that can change, but some attributes remain constant.
    • The application’s UI structure is subject to frequent updates.
    • You want to prioritize flexibility over accuracy, and minor UI changes won’t affect the automation’s functionality.

Best Practices:

  1. Whenever possible, try to use strict selectors, as they provide more reliable and less error-prone automation.
  2. If you need to use fuzzy selectors, limit the use of wildcards (*) in the selector to minimize the chances of selecting unintended elements.
  3. Use the UiExplorer tool in UiPath Studio to fine-tune your selectors and validate their accuracy.

Hope it helps!!

1 Like

@c.ciprian
Fuzzy Selector:

  • 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.
1 Like

@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:

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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

Hi @c.ciprian

  1. Use Strict Selectors When:
  • 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.
  1. 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.

Hope it helps!!

@c.ciprian

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

Cheers

Thankyou all for the responses. I’ll go with both strict and fuzzy in order to have best speed and also accommodate small changes.