New to UI automation, using Appium WinAppDriver on a UWP app, i am trying to find a way to get a list of all the elements in a particular ListView
control, and then get values form each. I am maybe wrong, but there appears to be a child/parent relationship between some WindowElement
, which can be seen when examining an particular screen in inspect tool. Please consider below simplified piece of code:
WindowElement x = session.FindElementsByClassName("ListView").ToList()[1];
List<WindowElement> y = x.FindElementsByClassName("ListViewItem").ToList();
foreach(WindowElement z in y)
{
string name = z.FindElementByName("itemName").Text;
string id = z.FindElementByName("itemID").Text;
}
- Is this a correct approach in general, or am i missing something fundamental about this? I want to get a list of all of the items from a ListView
- This statement:
List<WindowElement> y = x.FindElementsByClassName("ListViewItem").ToList();
gives me an error becauseFindElementsByClassName()
apparently returns a list ofAppiumWebElement
and notWindowElement