Facing problem to click list item

Apr 3, 2012 at 12:16 PM
Edited Apr 3, 2012 at 12:26 PM

Hi,

i have a Window, which contains a GroupBox and the GroupBox contains a List and we have to right click on the 1st ListItem.

But UISpy is not displaying automationID for any of the list items, although Control Type and Name are available.

How should i proceed with that?

 This is my code

 

Window

 

 

window1 = application.GetWindow("TERRITORY LIST" );

GroupBox grp1 = (GroupBox)window1.Get(SearchCriteria.ByAutomationId("GroupBox1"

));

 

 

grp1.Focus();

ListBox lstBox = (ListBox)grp1.Get<ListBox>(SearchCriteria.ByAutomationId("lstTerritory"

));  

 

 

lstBox.Select(0);

 

 

 

i have tried this also

window1.Get<ListItem>(SearchCriteria.ByText("LINE 1 SEWARD" )).RightClick();

but it is not working.

 

 

 

 

 

 

Apr 3, 2012 at 12:55 PM

can you debug this?

 

what does listBox.Items show?

Apr 4, 2012 at 9:22 AM

Hey Throndorin,

Thnks for the suggestion :)

i debugged it and found out that it was not a "ListItem", it was a "Label" but UISpy was showing the Control Type as "DataItem" and UIAVerify was showing it as "ListItem".

now i have successfully right clicked at that label and i want to select an item from the right click menu.

please suggest me what will be the control type of that item and how to proceed further?

 

Thanks in advance