Forum Discussion

Vitalii's avatar
Vitalii
New Contributor
14 years ago

Can't obtain "Preferred Menu/Menu Type" dialogs

Hi


I have application which used next controls:


System.Windows.Forms.MenuStrip (horizontal bar - File, Help) 

System.Windows.Forms.ToolStripDropDownMenu (vertical drop down "File open" for File, and "About" for Help)


I want use them like


menuobject.Click("File|File Open");


But TestComplete generates code like


menuobject.Click(1,3); 



I have found on these pages that I could use MainMenu, but I can't obtain dialog where I can select MainMenu controls


http://smartbear.com/support/viewarticle/12898/


http://smartbear.com/support/viewarticle/12897/



Additional info:


ClrClassName: MenuStrip

ClrFullClassName: System.Windows.Forms.MenuStrip

Product version: 2.0.50727.5420 (.NET Framework 2.0)



ClrClassName: ToolStripDropDownMenu

ClrFullClassName: System.Windows.Forms.ToolStripDropDownMenu

Product version: 2.0.50727.5420 (.NET Framework 2.0)





Windows 7 x32

.NET Framework 4

TetsComplete 8.20.538.7




  • Vitalii's avatar
    Vitalii
    New Contributor

    Hi.


    I got that dialog, but can't click on desired item in toolbar. I tried this:


    menuobject.StripMainMenu.Click("Home")


    but without success


    Will be grateful for help


  • Hi Vitalii,


    As I understand, the recorded menu clicks actually look like wndObj.StripMainMenu.Click("[0]|[1]"). If so, what happens when you use the Click("Item 1|Subitem 1") syntax? If an error message is displayed/posted to the test log, please post a screenshot showing the message here.


    BTW, note that there are some peculiarities in menu items naming (see the Menu.Click help topic for more information).

  • Vitalii's avatar
    Vitalii
    New Contributor

    When I'm trying to use StripMainMenu I got error


    Unable to find the object StripMainMenu. See Additional Information for details.


    You are trying to call the "Click" method or property of the "StripMainMenu"
    object that does not exist.



    As I understand StripMainMenu should support MenuStrip controls
     


  • Hi Vitalii,





    Looks like you're working with a wrong parent object. Please examine your application's windows in the Object Browser and try the one which exposes the StripMainMenu property. Note that the property should also return a non-null object which can be used to obtain menu items (you can explore the object returned by the property in the Object Browser too).