4

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

enter image description here

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

Demodave
  • 6,242
  • 6
  • 43
  • 58
  • Not sure what you expect. If you traverse the xml in your example, how could you possibly get "repair Exceptions"? – JonasH Apr 14 '20 at 21:51
  • @JonasH the xml doesn't show what is displayed on the screen. – Demodave Apr 16 '20 at 13:38
  • that is my point. What should the logic be to transform the data in the xml file to the thing displayed on the screen? Simply count xml rows for exceptions/warnings? What would a xml-file that contains exceptions/warnings look like? – JonasH Apr 17 '20 at 07:11
  • i can't understand your explaination either. sorry – Thomas Sportouch Apr 21 '20 at 12:34

1 Answers1

0

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)"

Demodave
  • 6,242
  • 6
  • 43
  • 58