A developer is building a UiPath automation that interacts with a web application. The application's UI elements have dynamic IDs that change on each page load. The developer decides to use the Object Repository to manage UI descriptors. Which TWO actions should the developer take to ensure the automation remains stable despite the dynamic IDs? (Choose two.)
Trap 1: Store the dynamic ID as a variable and update it at runtime.
While runtime variables can be used in selectors, this approach requires capturing the dynamic ID each time, which is impractical and error-prone for every page load. It also adds complexity and may not be feasible if the ID is not easily retrievable. The Object Repository is meant to abstract selectors, not to manage runtime variables for each element.
Trap 2: Use the 'Image' and 'Text' recognition modes exclusively.
Image and Text recognition modes can be used as fallbacks, but relying exclusively on them is less reliable than using proper selectors. They are slower and may fail with resolution or theme changes. For dynamic IDs, the best practice is to refine selectors with wildcards and anchors, not to abandon selector-based automation entirely.
Trap 3: Enable the 'Fuzzy Selector' option for each UI element.
Fuzzy Selectors are designed to handle minor variations in text or attributes, but they are not primarily intended for dynamic IDs that change completely. They work best for slightly inconsistent text or layout changes. For dynamic IDs, wildcards and anchors are more direct and reliable solutions. Fuzzy Selectors might introduce false positives and are not the recommended first approach.
- A
Store the dynamic ID as a variable and update it at runtime.
Why it fails: While runtime variables can be used in selectors, this approach requires capturing the dynamic ID each time, which is impractical and error-prone for every page load. It also adds complexity and may not be feasible if the ID is not easily retrievable. The Object Repository is meant to abstract selectors, not to manage runtime variables for each element.
- B
Use the 'Image' and 'Text' recognition modes exclusively.
Why it fails: Image and Text recognition modes can be used as fallbacks, but relying exclusively on them is less reliable than using proper selectors. They are slower and may fail with resolution or theme changes. For dynamic IDs, the best practice is to refine selectors with wildcards and anchors, not to abandon selector-based automation entirely.
- C
Use wildcards in the selector attributes within the Object Repository.
Wildcards (such as *) can replace the dynamic portion of an ID attribute, making the selector match elements even when the ID changes. This is a recommended practice for dynamic web elements. By incorporating wildcards into the selector stored in the Object Repository, the automation can reliably locate elements without being affected by changing IDs.
- D
Add multiple anchors to the UI element in the Object Repository.
Anchors provide additional stable reference points relative to the target element. When dynamic IDs are present, anchors with stable attributes can help locate the target even if its own attributes change. Adding multiple anchors increases robustness by providing alternative ways to identify the element's position in the UI hierarchy, thus improving selector reliability.
- E
Enable the 'Fuzzy Selector' option for each UI element.
Why it fails: Fuzzy Selectors are designed to handle minor variations in text or attributes, but they are not primarily intended for dynamic IDs that change completely. They work best for slightly inconsistent text or layout changes. For dynamic IDs, wildcards and anchors are more direct and reliable solutions. Fuzzy Selectors might introduce false positives and are not the recommended first approach.