Page 1 of 1

How to select third and fourth level menu.

Posted: Mon Aug 27, 2007 2:19 pm
by prashantb
I am using C# to test my application. I want to select Third level sub menu like "File > New > Project"

I am using following method but it won't work.
ret = MenuControl.SelectItemText("File", "New", "Project");

Also, please tell me how can I select fourth level Menu like "File>ABC>EFG>XYZ"

Posted: Wed Aug 29, 2007 12:31 am
by webops
There are a lot of menu implementations from Microsoft and from other companies.
Ranorex also has more possibilities to access menu items, please give us the following information:

Is your application a .NET2003, .NET2005 or an older application?
Has your menu bar a control name?

Jenö Herget
Ranorex Team

Posted: Wed Aug 29, 2007 6:12 am
by prashantb
Hi Jeno,
I am testing Visual Studio 2005 Add-in. Hence the menus I am referring here are Visual Studio 2005 IDE menus. These Menu have class name as MsoCommandbar. Ranorex is able to recognize it as Menu but it was not selecting third level menu item i.e. "File -> New -> Project"

Posted: Thu Aug 30, 2007 12:21 am
by webops
We have a sample for Visual Studio automation in the Samples directory of the Ranorex Installation: RanorexVS2005Automation.
Please check this sample, we open the new project dialog as follows:

Code: Select all

// Visual Studio has an old style menu bar, not a menu strip
Menu menu = new Menu(form);
if (menu == null)
{
    Console.WriteLine("ERROR: menu not found ");
    return 1;
}

// Select the File - New - Project menu
menu.SelectItemText("File", "New", "Project..."); 
Jenö
Ranorex Team