UI Element No Longer Valid

Hi, I am working in a UI Automation project and UI Path very frequently throwing an exception like “UI Element is no longer valid” but actually that particular UI Element is present in the screen.

Can anyone please help me to solve these kind of issues.

Hi @siva

It may be a selector issue. You could try to Indicate on screen again and check if the selector changes, if there is any dynamic attribute.
Could you be more specific regarding the UiElement in the screen?(a button, a text box, a dropdown etc.)

2 Likes

If i tried to re-run the same scenario it is working fine. Not sure about why this is occurring.

Hi @siva,

Are you trying to automate web based process ? Is UI Element is HTML selector, if so the error may be because of dynamic content. Can you share the selector here.

Well, this issue looks like it occurs randomly. Some times this “UiElement is no longer valid” error pops up in a specific place and when re-running the process again, magically doesn’t appear any more.

If it would be an issue with the selector, errors such as “Selector cannot be found” or “Selector not valid” would appear instead. However, this other error might be due to the fact that, actually UiPath finds the button that matches perfectly with the provided selector but when goes to click on it, right in that time, the page refreshes and, even if you end up having an Element that still matches your selector, you are still holding a reference to the “old” object, which doesn’t exist anymore in the page.

Not sure about how to solve this problem. Maybe retrying to click on it if this error appears.

1 Like

Retry looks valid approah to have the better performance. I put activities in retry scope setting sufficient configuration(e.g.3 retries with interval 00:00:01). Checked in the run - clicks worked on second retry.

There was another approach discussed on forums - putting delays. I find this approach really bad because it significally slows the process performance…