UiElement is no longer valid - an issue without any obvious reason

Hey guys,
I am currently working on a process where I automate SAP in InternetExplorer. Everything works smoothly most of the time but sometimes, for no obvious reason, when the robot works with a pop-up window, one field, where a text is supposed to be found, is “no longer valid” (other typing fields/clicks work just fine). What I really don’t understand is that when I try to open UiExplorer through the selector of this “no longer valid” element to check if it exists, it finds it, imho meaning the element is OK and there shouldn’t be any problem working with it.

Any ideas why this error might occur? Thx!

1 Like

Hi MarekBo!

Looks like this issue 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.

Thanks, Marinabir. Well I have to solve it since we obviously cannot deliver unreliable automation :smiley: I have tried things like if element exists, try catch etc. but it didn’t work. I don’t know if it’s because of the fact that the “element” exists according to its selector but still isn’t valid or I made some stupid mistakes when developing the process.

Anyone has any experience with this issue?

I am hitting the same issue with my automation! It will run fine the first time my computer boots up. when i go to run it a second time it throws the error. I am using IE. could it be a caching thing? Help please :slight_smile:

1 Like

Please refer to link - UIElement is no longer valid

Makes sense.