Retry scope - bot executes action first time before condition is checked

Hi Everyone,

Using retry scope activity and the bot executes the action part without checking the condition and then only checks the condition Could anyone clarify on this.


Can you elaborate? I hope you have gone through this link already

Hi @PrankurJoshi. Thank you. I am able to understand its flow but retry scope first it should check the condition and then only action part must be executed but this activity first action part executes in the flow and checks the condition and based on the condition it retries.

Yeah, I think that’s the intent of the Retry Scope. It should perform some actions and if it throws an error or a condition is not true at the end, then retry those actions.

If you want to only do the actions if a condition is true first, then you need to use the If activity or something like that.

I hope that clarifies it better.


Thank you. I will check how it helps in my project. How the bot know if error comes it should retry. For eg I can put element exists by identifying that element but how to give instruction to bot to retry if error occurs.

By default, the Retry Scope will retry when an error is thrown. So you can technically leave off a condition activity and it will still retry if errors happen. When you add a condition activity, it will still retry when an error is thrown.

Does that answer it?


Thank you @ClaytonM. Will it retry for any error like selector not found or ui element no longer valid?

Yeah, it should.

Also, you can set the ContinueOnError to true if you don’t want an exception to be thrown when all the retry attempts are done. It should throw whatever exception that occurred on the last retry, if you have it set to False or empty.

Thank you @ClaytonM. Could you please also clarify or give suggestion on another question?

Here it is.

I am completing some actions in salesforce this is attended bot i.e an agent will trigger the bot using some hot key. After updating some details in salesforce bot moves its control by opening a new IE for a new application. Now bot does some check in the new application and moves back to salesforce browser page and completes the remaining action.

Now it works fine without any issues as we have opened only one tab. We are just making the bot to identify the ie icon on the task bar to move the control back from new application.

I know if we use browser variable inside the open browser activity we can easily give the control to the same browser. The issue is the agent opens the browser manually first time and clicks on the case id to triggers the bot. we are not able to use browser variable to track the browser. Is it possible to use browser variable without using open browser activity like passing browser variable with browser url in the variable?


Yeah. You basically want to use either the Attach Browser or the Attach Window, then use a Selector so it can connect to the window with the correct application and title, et cetera.

However, there are some challenges to this, because if you have multiple windows of the same thing open, it can attach to the wrong one. There might be ways to get around this though, like if it’s looking for a specific value in an element, it can look for that element that contains the value. I’m not quite sure how UiPath chooses the windows when there are multiples of the same window.

There could also be some solutions on getting the process id of each window and killing the one that isn’t being used.

So ensuring you are on the correct window is the tricky part. And, to be honest, I’m mostly experienced in unattended where the robot will close all the unnecessary windows and it always is using the most active instance of the window.

Short answer though, is use the Selector in Attach Browser or Attach Window, and that should work.


@ClaytonM. I got it. I will try your way. Thank you again.

@ClaytonM Hi,

I am about to implement browser variable using attach browser

This is the actual selector when i indicated element using attach browser activity

“<html title=Case: 001221 ~ Salesforce - Unlimited Edition />”

now to make dynamic i am passing case number in the selector in the below format

“<html title='Case: '”+CaseNumber+“’ ~ Salesforce - Unlimited Edition’ />”

but throws error as “The selector is not valid”

Is there any rule we will not able to give dynamic selector in attach browser or could you please throw some light on this?


@ClaytonM The above issue fixed and it is working now as expected and thank you for your idea.

1 Like