Forum Discussion

martinp999's avatar
martinp999
New Contributor
15 years ago

Menu.Click() inconsistency

Is there any way to make the Menu.Click method more consistent?



I am on TestComplete 5 and am driving some context menus that come up when right-clicking on items in the Windows Explorer list.  The function does not visually appear to move the mouse correctly as stated in the help (may be related to the fact that these menu have dividers between some items?), but this is probably insignificant because it manages to trigger the click event on the correct menu item... about 98% of the time.



It is the 2% of the time that it fails to trigger the menu item that is frustrating.  In these cases it throws no errors but the event is not fired.



I have tried using both menu labels "third menu item|second sub-menu item" and indexes "[3]|[2]", but that does not seem to improve reliability much.



I suspect that, if I were somehow able to put some waits into the Menu.Click method itself, reliability would improve.  Is there any way to do this?



Thanks

Martin

  • Hi Martin,





    Try increasing the value of the 'Delay between events' project option from the 'Playback' options group. To open the project properties editor, double-click the project node in the 'Project Explorer' panel and switch to the 'Properties' page.
  • martinp999's avatar
    martinp999
    New Contributor
    Thanks for the tip David, but it wasn't exactly what I had in mind.  The setting you have identified delays execution between lines of code in the script.  Menu.Click's implementation carries out several 'actions' internally and it is between these actions that I want to put the delay.  But, because Menu.Click only takes up one line in my script, the setting has no effect.

  • Hi Martin,





    Ok, in this case I can suggest that you check how TestComplete 7.52 works in this situation. There were a lot of changes since TestComplete 5 and the issue you face can be already fixed. Moreover, we do not create any fixes for TestComplete 5 anymore.





    Please let me know your results.