On Element Appear; how to wait without timeout


#1

Hi, I want the robot to stay in the background until he recognizes an open PDF, then he performs some actions and finally, he goes back to waiting state. The special point is that I want this activity to be able to wait for a long period of time (e.g. 15 min). Would this be somehow possible?


#2

use do while element exist will be you PDF container
Capture

and until this will become true it will wait.


#3

@Jizh @Divyashreem

Using while loop will lead to infinite looping if the element is not at all found(Due to any error).
Best approach is to use retry scope and set the delay in “RetryInterval” and number of retries to be performed in “NumberOfRetries” properties.


#4

Thanks for the input. @Madhavi how would I use the NumberOfRetries then if I want the application to wait for let’s say 20 min?
My reasoning: In an office situation, an employee could receive a call or another interruption happens. If the employee has to start the robot again and again (attended) he could be discouraged to use it.


#5

It sounds like you are interested in MonitorEvents, however I have not used it enough to know how they work in regards to wait time.

One approach for dynamic waiting I use many times when dealing with file exists or something smilar is using the Retry Scope. This will let you avoid infinite loops and it will keep looking for a certain state of your screen or file.


So in that example, it will keep looking if an element exists every second for 3600s = 1hour. Then it will throw an exception once it is passed the retries, unless you set continueonerror to true.

You can also change it up depending on what you need like to wait for a file to exist, then remove the inner Activity and just use the Boolean Is True activity with File.Exists(filepath)

I don’t know how well this will work for you, but it’s an option for waiting until something is True.

Regards.


#6

You can also put the Element Exists in the Condition side, since it’s a Boolean activity (silly me)
image
Which always removes clutter in your code.

Regards


#7

@ClaytonM Thanks for the example. Also, MonitorEvents seems pretty interesting. I will have a look at it.


#8

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