Forum Discussion

russelld's avatar
russelld
Contributor
7 years ago

Menuitems

Hi,

I'm having issues trying to run a simple menu selection.  I tried mapping the menu name AssociateMaintenance but it wouldn't work & the object spy couldn't find the mapped name.

 

The script attached opens the main menu 'Associate' but it won't click the 'Associate Maintenance' menuitem.

 

Any Suggestions?

 

Thanks in advance

Dave

 

 

  • Next thing, then... the Overlapping Window error has, in the Additional Info panel, a descriptor of what window it actually is.  That's the next step in diagnosing... what, exactly, is overlapping?

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    My thought:

     

    It is entirely likely that this is a timing issue.  Keep in mind that TestComplete executes the script code as fast as possible.  So, if there is any sort of delay between the first click and the popup being visible, then your code will fail.

     

    Insert in between the two clicks some sort of delay.  I would recommend using something like a "WaitProperty" on the popup to wait for the Visible property to be true.  If you simply want to test the theory, you can add a Delay(1000) in between to see if this corrects the problem and the retrofit the WaitProperty call.

    • russelld's avatar
      russelld
      Contributor

      I tried with a delay and with waitproperty but I get the same result.

       

      The 2nd screenshot is the menu option mapped, does that all appear okay?

       

      Thx

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        In your original post, you posted a screenshot showing the object browser.  In that object browser, the Popup window... notice how it is in a grey font rather than black like everything else?  That means that, at the time of the screenshot, it is not "Visible".  Everything is present, but that popup is not actually visible.  So, that means that, when you click on the menu to generate the popup, before you click on an individual menu item, you need to wait for that popup to be Visible.  

         

        So, your code should include, after the click on the menu, something like

        Aliases.menubarApplication.menuitemAssociate.popupAssociate.WaitProperty('Visible', true, 2000);
        This will wait up to 2 seconds for that popup to actually resolve as visible before you attempt to click on the individual menu item. The clue is the "Overlapping Window" error.... there is something that is overlapping what you're trying to click.... and I'm guessing that it's because the popup isn't fully resolved yet. Give the above a try.