I am trying to automate list view in my application and want to select multiple rows together to perform some opration but i am unable to do that it is selecting only one row at a time.Please guide me and send me the code for the same.
Thanks in Advance
How can Select multiple rows together in ListView
You can select multiple rows as follows
Hope this helps!
Gabor
Ranorex Team
Code: Select all
ListView listView = form.FindListView("listView1");
if (listView != null)
{
listView.Focus();
Element row1 = listView.Element.FindChild(Role.ListItem, "item1");
row1.Select(Selection.TakeSelection);
Element row2 = listView.Element.FindChild(Role.ListItem, "item2");
row2.Select(Selection.AddSelection);
}
Gabor
Ranorex Team
How to select mutiple rows by index
Here the above code is working fine but problem is here that we can not select the two rows which have same text.Like if in a listview under a column ITEM there is row's text same like "item1" ,"item1" then i am unable to select both row together it will take only one row .So is there any facility so that i can select the row on the base of their index?Then i think confilction will not occure.So please tell me how can i select multiple row uniquely using index of listview.
Regards,
Saurabh Shrivastava
GE Global Research
Bangalore India
Saurabh Shrivastava
GE Global Research
Bangalore India
You can select all rows with the text "item1" as follows:...row's text same like "item1" ,"item1" then i am unable to select both row together it will take only one row
Code: Select all
Element[] items = listView.Element.FindChildren(Role.ListItem,"item1");
foreach(Element item in items)
{
item.Select(Selection.AddSelection);
}
Ranorex Team