Unable to Automate/Handle MenuStrip and MenuStrip Items

Ask general questions here.
Nagulameera Shaik
Posts: 7
Joined: Mon Jun 13, 2016 8:33 am

Unable to Automate/Handle MenuStrip and MenuStrip Items

Post by Nagulameera Shaik » Thu Jul 14, 2016 8:38 am

Hi All,

I have menu-bar of type System.Windows.Forms.MenuStrip. When I am tracking the control I am getting the control of type Ranorex.MenuBar, here is control xpath:
//menubar[@controlname='menuStrip' and @controltypename='MenuStrip' and @instance='0']

using the above menu bar I am not able to click any menu item (Ex: File, Language,Label ect..). Please find the attached screen shot.

I tried the following ways
public void SelectMenuItem(Adapter menuStrip)
{
MenuBar menuBar = menuStrip as MenuBar;
foreach(var menuStripItem in menuBar.Items)
{
}
foreach(var menuitem in menuBar.Children)
{
}
foreach(var elementMenuitem in menuBar.Element.Children)
{
}
}

AND

public void SelectMenuItem(Adapter menuStrip)
{

foreach(var menuitem in menuStrip.Children)
{
}
foreach(var elementMenuitem in menuStrip.Element.Children)
{
}
}

Same issue with context menu item as well. Not getting the item's/children's to operate/click.

It is simple menu-bar and almost 70% automation is blocked due to this.

I Checked in the product code and it is absolutely fine. just for you reference
- Created main menu which is menu-strip -- able to get the control
- Created the items(file, language,ect) and added to the main menu -- not getting the items at all
- Created the context menus for each menu item -- able to get the contextmenu
- Created the items(Synchronize,work offline, etc) to each context menu item -- not getting items at all

Let me know if required any further information. Any help is appreciated.

Thanks in advance
Attachments
MenuStrip.png
MenuStrip.png (7.07 KiB) Viewed 751 times

User avatar
Vega
Posts: 109
Joined: Mon Jul 11, 2016 2:15 pm

Re: Unable to Automate/Handle MenuStrip and MenuStrip Items

Post by Vega » Thu Jul 14, 2016 2:53 pm

Hi Nagulameera Shaik,

Try using the info object for your menu items in conjunction with CreateAdapters<Type>();

Posting a snapshot would allow me to investigate your specific scenario more in depth.

Hope this helps!

Nagulameera Shaik
Posts: 7
Joined: Mon Jun 13, 2016 8:33 am

Re: Unable to Automate/Handle MenuStrip and MenuStrip Items

Post by Nagulameera Shaik » Fri Jul 15, 2016 6:32 am

Dear Vega,

Thanks for your quick replay, Here the problem is ranorex not identifying menuitem object itself, how can I get menuitem info object.

I tried through parent(menu bar) info object as well as actual object but failed to get the menuitem.
As I mentioned, I tried parent(menubar).children, parent.element.children and parent.items. In all scenarios I am getting children and items are zero.

Even tried AccessibleName, AccessibleRole etc properties also.

Now I am planning to find the solution together with developer by changing the some of the properties of the menuitem.

Meanwhile any help is appreciated.

User avatar
Vega
Posts: 109
Joined: Mon Jul 11, 2016 2:15 pm

Re: Unable to Automate/Handle MenuStrip and MenuStrip Items

Post by Vega » Fri Jul 15, 2016 2:10 pm

Hi,

Do you know what technology is being used? Without seeing your SUT/scenario, here is something you could try:

You can try to utilize GDI capabilities in spy by right clicking your topmost parent form and selecting "Add process name to GDI capture list".
GDI.png
GDI.png (41.76 KiB) Viewed 714 times

I hope this helps!