A developer indicated a Ul element for a Get Text activity. The automatically-generated selector is shown below.
<html app=, chrome.exe, title='temperature now1 />
<webctrl tag='table' class=, ui_side_menu' innertext-19°C 66°F' />
Based on best practices, which selector attribute is unreliable?
Correct Answer: D
Based on best practices, the selector attribute that is unreliable is innertext. The innertext attribute is the text content of a UI element, such as a table, a button, or a label. The innertext attribute is unreliable because it can change dynamically depending on the data or the state of the UI element. For example, the innertext attribute of a table can change when the table is updated with new values, or the innertext attribute of a button can change when the button is clicked or disabled. Using the innertext attribute in a selector can cause the selector to fail or to identify the wrong UI element if the text content is different from the expected value1. Therefore, the innertext attribute should be avoided or replaced with a more reliable attribute, such as tag, class, or title.
The tag attribute is the name of the HTML element, such as table, button, or input. The tag attribute is reliable because it does not change unless the UI element is replaced with a different element. The class attribute is the name of the CSS class that defines the style or the behavior of the UI element, such as ui_side_menu, btn-primary, or form-control. The class attribute is reliable because it does not change unless the UI element is styled or modified differently. The title attribute is the text that appears when the mouse pointer is hovered over the UI element, such as temperature now, submit, or username. The title attribute is reliable because it does not change unless the UI element is renamed or removed2.
References: Selectors with Wildcards and UiPath Selectors from UiPath documentation and forum.