UiElement No Longer Valid but IS Valid

I could use some help with something that is driving me crazy!

I have an application with a window that has a field that I am typing into. It might run through that field 3 times or 30 times then suddenly I will get “The UiElement is no longer valid”. When I click on the Edit Selector the Validate immediately turns green. So it is valid. I am tried various combination of slight delays and Wait For Ready but still get this randomly.

Can someone give me a hint of something to try to make this consistent? Thank you

2 Likes

Try putting your activity in a Retry Scope. Then use Element Exists to find an item on the screen which only appears after the action is taken.

modify your selectors accordingly, for better accuracy use Anchor Element
@Chris_Livesay

1 Like

So far, same result. The retry scope it ran a couple times then same result. With anchor, I get value does not fall within the expected range even though I have used the position (Left) and have tried a find element and find image. Like I said before, my selectors are good. UiPath finds the element and validates.

So frustrating.

I encountered this same error recently and in my case it was happening on Find Element selectors that: (1) had a wild card character (*) in the strings, and (2) the selector criteria was not immediately met [i.e. it took a second or two before the screen changed to match the criteria]. I worked around the issue by first doing a Find Element on a tab contained in the updated screen that did not require the wild card in the selector to ensure the subsequent Find Element (with the wild card) criteria would be immediately met. This worked for me. Maybe it will help some others.

For my case, the UIElement is inside an “Attach Window”.

In my process the Attach Window has the same selector but the Window reappears after I click Okay.

So I believe the UIElement become invalid because the Window is no longer the same window although it has the same selector.

What I did is to put the UIElement in a new Attach Window.
I hope this could help others.