Get Text: The UiElement is no longer valid

I have this print page that I need to set to Save to PDF setting. So I tried putting Get Text on the Drop Down Menu, to see if it is set to Save PDF, if not change it. The Problem is sometimes, it would give this error. It won’t validate even though the selectors are correct, It it will validate but after a few secs, it won’t. I tried adding 10-20 secs delay before, and set the Wait For Ready to Complete, but it won’t work.

Hi @Shinjid

Can you share the selector in the UI EXplorer

You can also try to use Screen scrapping Method


Here’s the code:

<wnd app='msedge.exe' cls='Chrome_WidgetWin_1' title='*' />
<ctrl name='*' role='document' />
<ctrl name='*' role='menu button' />

This is what I’m trying to get the text from:

It works most of the time, but there are times that even adding a 20 sec delay won’t make it validate fully.

1 Like

Hey @Shinjid

Could you please post the screenshot for the same ?

The element from which you are trying.



1 Like

Try to use Screen scraping method @Shinjid


Hi, I have faced similar issue,
When the Pdf is opened there will be download icon, you can click on that it will give the popup save as there you can save the file. Which is easy. To click that download icon you can use click image. It worked for me. Try in this way.

1 Like

Hi @Shinjid it will be easier to use download icon for pdf downloads.
Just click on download icon and if the selector is not validated select image as well and try.

I tried using get OCR text on the Drop Down menu. I get this “[-3.- w]”

Is it a different activity?

Since this page is a public website. I’ll share the website:
United Nations Security Council Consolidated List | United Nations Security Council
I’m trying to download and save the Consolidated list of it as a PDF.

Hi @Shinjid yes click image if normal click is not working for download icon

Could you please show the selector of that in Ui-Explorer with the props.


Let’s try a simple method to solve this

Place this get text activity inside a action block of RETRY SCOPE and leave the condition block empty

Set the number of retries as 5 and interval as 5 seconds

And now this will try for 5 times which should definitely get the text

But still if that doesn’t to just avoid exception and to continue further surround this retry scope with a try catch block

Cheers @Shinjid

Here’s the undedited one.

<wnd app='msedge.exe' cls='Chrome_WidgetWin_0' idx='*' />
<wnd aaname='' cls='Chrome_RenderWidgetHostHWND' title='Chrome Legacy Window' />
<ctrl name='Printer Save as PDF' role='menu button' />

I’m not sure if this could be the problem. But for some reason, this selector uses and idx. I put wildcards on aaname since the link is dynamic.

Thanks. I’ll add this too.

1 Like

I tried, still the same. I check the selector, and it says it’s valid.

1 Like

I m just wondering why we need this text to be fetched

If we are trying to change the value as save as pdf then we can directly change isn’t it


I’m trying to minimize the steps, I did try using select item on it but it does not support the control. If the problem persists, I can I’ll add the step. Though I’m worried that it would give the same problem since it uses the same selector.

1 Like

Hey @Shinjid

When the bot runs is that page open with the same selector props ?