"The UiElement is no longer valid"

Is there anything we can do about “The UiElement is no longer valid” error?
I am using a software application written on .Net framework. UiPath Studio can pick up most elements.

I am trying to Type Into a textbox. This Textbox’s element can be picked up using Indicate Element inside window, and I adjusted the selector so it can be used for all transactions.

Now the weird part is, when I run the program, the first transaction always fails when trying to Type Into, with the error message The UiElement is no longer valid even though the TextBox is right there and visible.

When I close the application and check the selector, it says “Valid”, so the selector seems fine. What is even more weird is, the first transaction always fails, but after the second transaction, it works fine.

Why does this happen? Is there any way to fix this?

1 Like

maybe wait for ready complete, or a little delay before first try…

1 Like

Seems to be something with the selector @tomato25.
Did you try UiExplorer for selectors?
Did you try identifying difference in the selector while its a first run, and then consecutive runs?
I had trouble when I was including IDX in a selector.

The selector is the same during the first run and the second run, as far as I know.

But the selector does include “idx” attribute, because it seems like this attribute is very important to identify this specific Textbox element.

It could be different scenario for you, but I was trying to automate FileZilla, and the IDX was a blocker. After every upload, the IDX would change randomly. I was not able to automate using FileZilla and had to use an alternate way.
Yes, IDX could be a very important identifier.

1 Like

@tomato25
First, get the selector before first run, also get attribute values - like of IDX.
Second, perform the first run manually.
Now, get the selector again, and the attribute values - like of IDX.

Compare them and see how it goes.

1 Like

Actually, I figured it out now.
I was thinking what could be different between the first run and after the first run, then I thought that maybe the elements haven’t been ready during the first run.

I just added Delay of 10 seconds only during the first transaction, and it fixed the problem!
The tricky part was, I had already tried using Delay, but it didn’t work because it was too short!
I already tried with Delay of 3-5 seconds before Type Into, but it didn’t work.
I just increased it to 10 seconds, and it started working…

Thank you very much for your help!

so you did what i said and put the green mark on yourself? :upside_down_face: :laughing:

@bcorrea - I feel the pain :smile:

is funny, but it is no problem :stuck_out_tongue:

1 Like

Hey, I am sorry, I hadn’t seen your answer at all.
image

For some reason, your answer was not notified, and I only noticed and read @sumitd’s answers.
My apologies.

no problem, dont worry, i was just kidding.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.