How to select third and fourth level menu.

Class library usage, coding and language questions.
prashantb
Posts: 9
Joined: Thu Aug 23, 2007 3:59 pm

How to select third and fourth level menu.

Post by prashantb » Mon Aug 27, 2007 2:19 pm

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"
Regards,
Prashant Barhate

webops
Site Admin
Site Admin
Posts: 349
Joined: Wed Jul 05, 2006 7:44 pm

Post by webops » Wed Aug 29, 2007 12:31 am

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

prashantb
Posts: 9
Joined: Thu Aug 23, 2007 3:59 pm

Post by prashantb » Wed Aug 29, 2007 6:12 am

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"
Regards,
Prashant Barhate

webops
Site Admin
Site Admin
Posts: 349
Joined: Wed Jul 05, 2006 7:44 pm

Post by webops » Thu Aug 30, 2007 12:21 am

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