Forum Discussion

panka152's avatar
panka152
Contributor
13 years ago

Unable to get menu item through FIND method.

Hi, I need help on finding menu item through FIND method. I am testing a desktop application where I have to click Menu /submenu, I can do it using name mapping technique but unable to do the same using FIND method.



my script is :

set Menu = p.find("Name", "WinFormsObject(menuStrip1)",5)

menu.click "[2|0]"                       ........[Doesn't work, Test complete gives message 'unable to find the object']



--------------------------------------------------------------------------------------------------------------------------------------------



time being I am using the following script to perform testing is :



p.WinFormsObject("FormMain").stripmainmenu.click "[2|0]"        .....[It works]

2 Replies

  • Julia_K's avatar
    Julia_K
    SmartBear Alumni (Retired)

    Hello Pankaj,


    You cannot use the Find method to get menus and menu items.


    To get a menu, please use the MainMenu, SystemMenu, PopupMenu, StripMainMenu, or other properties.


    For example:



    Set Menu = Sys.Process("TestedApp").WinFormsObject("Main").StripMainMenu


    To get menu items, please use the Items property of the menu object. For example:



    Set MenuItem1 = Menu.Items("File")

    Set MenuItem2 = Menu.Items(1).SubMenu.Items(0)


    For more information on working with menus and their child items, please see the Working With Menus - Basic Concepts and Addressing Menu Items Help topics.


    Please let us know if you need anymore assistance.

    Thank you.