This project is read-only.

unable to select a listitem

Oct 29, 2010 at 1:56 AM



I am unable to select an item from the listbox. Can someone please help. Thanks.


istBox lb = myWindow.Get<ListBox>(SearchCriteria.ByAutomationId("timeComboBox")



 Also tried



I could get the selected item using the code however i am not able to select any item


item = lb.Items.Where(p => p.IsSelected).First();



MessageBox.Show("Selected: "+ item.Name.ToString());

Oct 29, 2010 at 7:58 AM


is it right, that you want to select a value from a combobox? (I think that because of the automation ID)


than you should use:


WPFComboBox cb = myWindow.Get<WPFComboBox>(SearchCriteria.ByAutomationId("timeComboBox");


You can use cb.Select(<name of the item>); if this works stable for you


In most cases I use


WPFComboBox cb = myWindow.Get<WPFComboBox>(SearchCriteria.ByAutomationId("timeComboBox");


ListItem item  = cb.Items.Where(p=p.Name == "name").First();








Oct 29, 2010 at 2:20 PM

It is a listbox and i want to select a list item. It's not a combo b ox.

Oct 29, 2010 at 3:45 PM

ok :)


beat the developer, the automatio ID says something other. :)


is the Listitem visible and enabled at the point of time you call click() ? (maybe your test is to fast)

use a Thread.Sleep(5000) for example before you perform the click();

and the same after

have a look on the item, does the mouse points to the correct position.


We should try to isolate the problem first :)