If we use retry scope and fail to met the condition after max retry, then common exception message will be as below:
“Action failed to execute as expected”
However, we cannot find at which activity error occurred and what was the error message. So how can we retrieve the exact error/ exception message from retry scope after max retry?
Say there is a selector issue in particular activity, I need to get that exact exception message.
Retry scope usually tries to retry the set of activities kept in action block until the condition mentioned is met
If the condition is not defined with any activity then retry scope will try to retry the activities mentioned in action block to the number of time we have mentioned in properties
In your case as you have the condition and number of retries to be made we can use DO WHILE as it will first execute and check for condition later like RETRY SCOPE
Don’t use While loop as it will first evaluate the condition and then only perform the operation
So the steps will be
—use a DO WHILE activity where place the set of activities to be performed in the Do block
And at the last inside the do block use a element exists or image exists activity and get the output as Boolean variable
We are doing this to replace the activity we place in CONDITION block of retry scope
—now in do while condition mention the above created variable
—so in DO WHILE the bot will execute the sequence of activities and finally check the condition with ELEMENT EXISTS or IMAGE EXISTS and get the Boolean variable
—that Boolean variable is now validated with DO WHILE condition block same as retry scope
—surround this DO WHILE with a TRY CATCH activity where place the above sequence in try block and in catch block use a common exception like SYSTEM.EXCEPTION
—inside the catch block use a WRITELINE activity where mention as
exception.Source.ToString
Will give the activity at which the error occurred