Simple Context Menu, Menu Item Selection

Apr 13, 2010 at 3:51 PM
Edited Apr 13, 2010 at 3:55 PM

I am very new to White.  I have a simple context menu, which pops up when you right mouse click on a tree note.  Selecting the tree node doing the right mouse click is no proplem to bring up the context menu, but I have not found a good example of how to find the context menu and click on a selection.  In UISpy what pops up is a Menu with no automation id.

Can anyone provide any sample code of how to find the menu and then select a menu item?

I also looked at this example, but it did not make sense to me because there does not seem to be any ItemBy method on the PopupMenu class. 

http://white.codeplex.com/wikipage?title=MenuBar%2c%20Menu%20and%20PopupMenu&referringTitle=Home

 Also, I don't have sub-menus, only a simple context menu.  I've been trying a few ideas, but nothing seems to work that I tried.  Any help is appreciated.

Thank you

 

 

 

Apr 14, 2010 at 7:11 AM

What Type of application do you test?

WinForm or WPF?

what elements do you see next to the menu?

can you select the menu items with UISpy (or UIAVerify)?

Throndorin

Apr 14, 2010 at 8:39 PM

Yes I can select the menu items using UISpy.  WPF.  I see MenuItem elements in the context menu.

I was able to get it to work this way:

window.PopupMenu("Manage Connected Project Areas...").click();

Now I have a new problem.

I'm trying to check a list box item in a list box.

Looks like I can get the ListBox

ListBox palistbox = window.Get<ListBox>(SearchCriteria.ByAutomationId

But,

palistbox.Check("the item I want to check");

Throws an exception.

Is this the right way to check (select) a list box item?

 

 

 

 

Apr 15, 2010 at 11:56 AM
Edited Apr 15, 2010 at 12:48 PM
ksandler645 wrote:

Now I have a new problem.

I'm trying to check a list box item in a list box.

Looks like I can get the ListBox

ListBox palistbox = window.Get<ListBox>(SearchCriteria.ByAutomationId

But,

palistbox.Check("the item I want to check");

Throws an exception.

Is this the right way to check (select) a list box item?

 

 

Hi

 

Try the following:

 

ListItem item = palistbox.Items.Where(p=>p.Name =="the item I want to check");

is item found?

item.Check();

 

 

Please add for new problems new Posts, so it is easier to find older Problems, and the post summary points only to the real problem.