A Web automation action (like "Click Link", "Populate text field" or "Get details of element" etc.) fails during runtime.
During the initial development of the desktop flow, the user was able to capture and interact with the web element.
Some web pages change their underlying HTML structure dynamically. Therefore, the CSS selector initially used to locate the element is no longer applicable.
Manually create a new more robust CSS selector, that will be able to locate the element of interest even though the HTML structure changes.
To achieve that, capture again the web element after the failure, and compare the new CSS selector with the old one.
CSS selectors can be reviewed and edited through the Selector builder window:
Notice the differences between the two selectors – there may be one or more elements/attributes that are different.
Edit the selector to contain only the static parts that are not prone to change. Some of the below methods could be followed:
Remove any dynamic values like numbers and modify the relevant Operators accordingly (Starts with, Ends with, Contains etc.)
Remove an entire element from the selector path if necessary
Locate the element using its text that is visible on the webpage using the “Contains” selector
The selector contains an element with a class that is dynamic, like div[class=”some_class123”]. This can be modified to div[class^=”some_class”] ("Starts with" operator)
The selector contains an element with many dynamic attributes like div[class=”some_class123”][id=”some_id123”] > a[id=”some_id”]. This can be modified to a[id=”some_id”] (omitting the first part completely)
The element of interest has some static text - the selector can be modified to include only that text. For example, div[class=”some_class123”][id=”some_id123”] > a[id=”some_id”] could be modified to a:contains(“the_text_we_see_on_the_webpage”)