Forum Discussion

howie_'s avatar
howie_
Contributor
11 years ago

Catching UICtrlsMainMenu.Click()


I'm still trying to find a way to improve UICtrlsMainMenu.Click()'s reliability (as per this post), and I came up with the idea of embedding a try-catch withing a while loop, but for some reason the error isn't caught. Here's my code: 



var success = false; 



while(!success) 

{

     try

     {

          Aliases.<product>.<form>.UICtrlsMainMenu.Click("[3|1|0]");

          success = true;

     } 

     catch(e)

     {

          Log.Message(e.description);

     } 

}



I've noticed that TestComplete will attempt to find the popup menu 3 times before it throws an (uncatchable) error saying "Couldn't not obtain the popup menu for item 1". Is there a way to change how many times it tries to click the menu? Or force it to try over and again? 



I'm open to any and all suggestions. 



Thanks, 

Howie 


No RepliesBe the first to reply