Ask a Question

UICtrlsMainMenu.Click failing occassionally


UICtrlsMainMenu.Click failing occassionally

Hey everyone, 

I've noticed that every once in a while I when I try to call:


I get a message bubble that reads: 

"waiting until the popup for the menu <menu> item to become visible"

This happens about three times, then ultimately fails. I've tried:

Aliases.<Product>.<Window>.UICtrlsMainMenu.Click("[3]"); => works

Aliases.<Product>.<Window>.UICtrlsMainMenu.Click("[3|1]"); => fails sometimes

Aliases.<Product>.<Window>.UICtrlsMainMenu.Click("parentMenu|[1]"); => fails sometimes

Aliases.<Product>.<Window>.UICtrlsMainMenu.Click("[3]|childMenu"); => fails sometimes

Aliases.<Product>.<Window>.UICtrlsMainMenu.Click("[3]|1|0]"); => fails pretty frequently

Sys.Process(<process>).Refresh() => doesn't seem to help

Here are some fun facts: 

- The application is always up and running

- The app is in a state where menu [3|1|0] is valid 

- TestComplete has  no difficulty reaching top-level items

- There are no competing processes

- There are no overlapping windows

- I really want/need to stick with the "[3|1]"-type notation, due to localization

Does anyone have any experience with this, who might be able to point me in the right direction? As always, any help would be greatly appreciated.


SmartBear Alumni (Retired)



Please check whether the suggestions from this thread help you:

When executing the Click method, TestComplete may drag the mouse cursor from one menu item to another one along your application. The cursor may cross other menu items, and they will become active, or the cursor can move to the application's window and the menu will disappear.


To avoid this situation, set the Mouse movement delay option to 0 - TestComplete will put the cursor to the needed position without dragging it. To find the option, select Tools | Current Project Properties and open the 'Playback' group of settings.

Tanya Yatskovskaya
SmartBear Community and Education Manager


Hi Tanya, 


I did see that article, which is why I tried running .Refresh(); I just double-checked my mouse movement delay and it's set to zero. The rest of the thread either doesn't seem to apply, or hasn't quite solved my problem. I ran some test cases to try to get more information, here are my results: 


Accessing a top-level menu:

Code:   Aliases.TestProduct.MainFormBase.UICtrlsMainMenu.Click("[4]"); //"Help"

Result: Pass


Accessing the first submenu: 

Code:   Aliases.TestProduct.MainFormBase.UICtrlsMainMenu.Click("[2|1]"); //"View|Expand All"

Result: Pass


Accessing the second submenu: 

Code:   Aliases.TestProduct.MainFormBase.UICtrlsMainMenu.Click("[0|0|1]"); //"File|New|DocType1"

Code:   Aliases.TestProduct.MainFormBase.UICtrlsMainMenu.Click("[0|0|1]"); //"File|New|DocType2"

Result: Pass




The "Tools" menu seems to be the only one displaying any unusual behavior...



Accessing "Tools" menu:

Code:   Aliases.TestProduct.MainFormBase.UICtrlsMainMenu.Click("[3]");

Result: Pass


Accessing "Tools|Options":

Code:   Aliases.TestProduct.MainFormBase.UICtrlsMainMenu.Click("[3|1]");

Result: Pass


Accessing "Tools|Options|Click Mode":

Code:   Aliases.TestProduct.MainFormBase.UICtrlsMainMenu.Click("[3|1|0]");

Result: Fail 

Fail Rate: 77/100



Accessing "Tools|Options|Restore Confirmations":

Code:   Aliases.TestProduct.MainFormBase.UICtrlsMainMenu.Click("[3|1|1]");

Result: Fail 

Fail Rate: 66/100



The only difference between the "Tools" menu and the rest of them is that "Click Mode" is checkable. There are no competing processes, no overlapping windows or popups, no other activities on the machine. The mouse movement delay remains at zero, and all other conditions are identical to the test cases that passed. The passing test succeed both before and after interactiong with the Tools menu. Refreshing between click attempts doesn't seem to change anything. In every other way this menu appears completely unremarkable. 


I think I've pretty much run out of ideas besides "don't touh the tools menu", which probably isn't a very good plan. Does any of this new information help? Is there something you'd recommend I try out? 


Thanks again for your help. 

SmartBear Alumni (Retired)

Hi Howie,


Have you tried adapting this script for your app?


Tanya Yatskovskaya
SmartBear Community and Education Manager

Showing results for 
Search instead for 
Did you mean: