ANW
14 years agoContributor
.NET newbie need help with menustrips and submenus
Hello experts
In my new job, I am starting to test .NET applications using TestComplete. Before I tested Delphi applications.
Presently I am just messing around with a few recorded scripts to learn how to access various .NET objects in the applications.
The first problem i came across is that the developers here use something called StripMainMenu (see first attachment). And that menu has a SubMenu. (see second and third screen shots). I want to click on a specific item on the submenu, but am unsure how to do this.
When I use the recorder, TC suggests the following code:
victorApp.StripMainMenu.Click('Værktøjer|Opret kunde');
While this works fine, I don't really want to have this kind of string in my code.
I tried this myself:
victorApp.StripMainMenu.Click(5);
victorApp.StripMainMenu.Items[5].SubMenu.Click(0);
The first line works and it activates the item i want, but when it executes the second line, the menu is closed, and it is waiting for it to become visible again.
Is there a good way around this?? ... or is that the way things work with these kind of menus?? ... if so, is there a better way to program the menus so they are more accessible for TC?
Thanks in advance
Anders
In my new job, I am starting to test .NET applications using TestComplete. Before I tested Delphi applications.
Presently I am just messing around with a few recorded scripts to learn how to access various .NET objects in the applications.
The first problem i came across is that the developers here use something called StripMainMenu (see first attachment). And that menu has a SubMenu. (see second and third screen shots). I want to click on a specific item on the submenu, but am unsure how to do this.
When I use the recorder, TC suggests the following code:
victorApp.StripMainMenu.Click('Værktøjer|Opret kunde');
While this works fine, I don't really want to have this kind of string in my code.
I tried this myself:
victorApp.StripMainMenu.Click(5);
victorApp.StripMainMenu.Items[5].SubMenu.Click(0);
The first line works and it activates the item i want, but when it executes the second line, the menu is closed, and it is waiting for it to become visible again.
Is there a good way around this?? ... or is that the way things work with these kind of menus?? ... if so, is there a better way to program the menus so they are more accessible for TC?
Thanks in advance
Anders