What is the best approach to waiting for menu items to appear rather than using a Delay....

  • 18 January 2022
  • 2 replies

Hello this is for an attended job.


I have a non-web based application that will bring up certain menus depending on what I click on. Once the menu comes up I then will click on one of the menu options and will go on to my next task.... My problem is that sometimes the menu options take a long time to generate depending on several factors outside of my control (slowness in server, slowness in application etc.)


For now I have used delay statements and sometimes the delay statements end being too long or not long enough. Right now I make the delay time longer just so I am covered but in turn it takes my automation longer to run. (I have to run this process thousands of times)


My question is what would be a better way to approach this? Should I use Image recoginition and wait for the actual menu to appear or is there some other method that is suited for this? Right now if the menu isn't there in time my process breaks and the script stops running. I ussually end up making the delay longer to give the application more time to generate the menu.

2 replies

Userlevel 5
Badge +9

Hey @ROGEE FEDELEON​ - I'd consider using the "If Object Exists" - conditional statement inside of a loop. Let the loop run X (try 5 to start?) times...inside the loop, the bot will check to see if the object exists...if not, have a delay...X seconds then let the loop run again. If the Object IS found, use the exit loop action to jump out of the loop. In this way, you're giving the padding for the operation to take up to XX seconds in total, but if the object is found (and the UI is being more responsive that day) - the bot isn't sitting and waiting for the maximum amount of time.

Hi Micah appreciate the feedback. I will take a look at doing this thank you!