Hi!
I have a list of WinListItem. Each item has a text and an image. The image represents a green check or a red cross. I need to access to this image to know if the UI is displayed in concordance with business logic.
I have tried to get it via ControlViewWalker because from what I understand from the documentation, it should be available then as a child of the item.
public void A()
{
var listItem = UIMapOptionsActivationWnd.UIFirstListItem.NativeElement as AutomationElement;
WalkControlElements(listItem);
// result?
}
private List<AutomationElement> result = new List<AutomationElement>();
private void WalkControlElements(AutomationElement rootElement)
{
AutomationElement elementNode = TreeWalker.ControlViewWalker.GetFirstChild(rootElement);
while (elementNode != null)
{
result.Add(elementNode);
WalkControlElements(elementNode);
elementNode = TreeWalker.ControlViewWalker.GetNextSibling(elementNode);
}
}
But I am stuck here. Result has no element. I have tried the code using the WinList as the rootElement and it works to get the ListItems.
I also tried with a RawViewWalker, without more success. I will take any other solutions too!
Thanks!