I am having trouble accessing the text within a DataItem. Is there a way to get the text ["Repair Exceptions(0)" etc] for each node in the TreeItem using windows application driver?
xml
<Group>
<TreeItem Name="Node0">
<DataItem Name="Item row 0"/>
</TreeItem>
<TreeItem Name="Node1">
<DataItem Name="Item row 1"/>
</TreeItem>
</Group>
What Data looks like on the screen
Further Investigation
Using Microsoft Inspect tool provided the details that I am looking for is the value.
Path: C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64\inspect.exe
ControlType: UIA_DataItemControlTypeId
I was able to pull it out using the element.Text.
var elements = session.FindElements(By.XPath($"//DataItem"));
foreach(var dataItem in elements)
{
Console.WriteLine(dataItem.Text);
}
"Repair Exceptions (0)"
"Input Exceptions (0)"