"Can not find UI Element" error in second iteration of retry scope

I have created a process where the bot will click on a link and wait till page gates loaded. Once the page gets loaded it will see if the page has returned output or not. If the page returns an error, it will try one more time (click on the same link one more time). I am using retry scope. For the first attempt, it finds the link and clicks on it. If the page returns an error, retry scope gets executed second time and now this time it does not find the link and gives “Can not find UI Element” error. Can somebody help me get rid of this error?

@sandyk

Instead of Retry scope you can place in a while loop Element Exists and give condition as Element Exists <> True

Hope this helps you

Thanks

Tried with while, do while and retry scope. Getting same error in all cases.

Hi @sandyk,
Check the element exists activity again whether it giving the right result.

Regards,
Aditya

Yes. It is giving the right result. For the first iteration, it identifies the element and clicks on it. But for the second iteration, it fails to identify the element and gives “Can not find element” error. I have also verified that the selector is valid and points to the correct element.

@sandyk,
can you share the selector here?

Regards,
Aditya

<html app=‘chrome.exe’ title=‘Statement of account’ />
<webctrl aaname=‘View all memos’ tag=‘BUTTON’ />

However, I think that issue is not with selector. The same selector works for first iteration of retry scope. But for second iteration, it gives error. Tried different combination of attributes in selector.

Hi @sandyk

i did see this error with retry scope have you tried using Do While?

Regards,
Aditya

Yes. Tried while and do while as well. But got same error with both loop.

@sandyk,
Are you doing the same like this
use element exists inside do and
if it exist it will give True else it will give false
so if it have to retry then condition would be elementexist output=False

Regards,
Aditya

Yes.

@sandyk,
can you share the workflow?

Regards,
Aditya

Sorry, I can’t. However I can tell you how i have written it.
While (element exist output <> TRUE )
{
click activity;
element exist activity;
}

I have found a way to tackle this situation. I am using hot key to set focus on link and then using “enter” hot key to click on that link. However, I think there should be a better solution to this.