Search code examples
c#.netwpfwpf-controlsflaui

How can I retrieve data from a List Element when the data is not visible when inspected using the FLAUI Inspect tool in a WPF application?


THIS QUESTION IS SOLVED. SCROLL BELOW TO FIND THE ANSWER

I'm working on UI Automation and I'm new to FLAUI. Here, I wish to extract the data that is annotated with an orange pen. The box highlighted in green is a listItem; it is part of a list. I wish to extract the data from this particular element.

UI

I tried to look up this element using the FLAUI Inspect tool, and this is what I found...

FlaUI inspect Tree

This is the details pane of the first ListItem in this tree, and it is the same for all the ListItem elements here.

FlaUI details pane

FlaUI details pane 2

Is there any way to extract this data from the UI using FLAUI, or is it simply impossible? Can you also provide a reference where I can read about the solution you suggest?

This WPF Application is Build on .NET Framework 4.7.2, c# v10. FlaUInspect v1.3.0.

Im trying to automate this using FLAUI Core (FLAUI.Core.Signed 4.0.0 and FLAUI.UIA3.Signed 4.0.0)

Sorry for all the abstraction I did using the red pen. It had to be done.

Edit 1:

I tried to inspect it with the Snoop tool, another UI inspector tool. Here, I was able to find the elements I had been looking for. The ListBoxItem is the element that was shown as a ListItem in the FLAUI Inspector tool, and the elements highlighted in blue are the ones I had been searching for. Unfortunately, I was not able to retrieve this data through FLAUI. Any help to find a way to get this data will be appreciated.

[![snoop Inspector tool][1]][1]


Solution

  • Solution: Here is the solution that worked for me...

    The Problem was with the TextBlock Elements used in building the grid rows. For some reason, TextBlock does not seem to be supported by FlaUI. We changed it to Label and it works now. My senior helped me figure this out.

    Roughly the code looked like this before

    <Grid>
      <Border>
        <TestBlock Text="{Binding data}"/>
      </Border>
    </Grid>
    

    Now we changed it to this

    <Grid>
      <Border>
        <Label Text="{Binding data}"/>
      </Border>
    </Grid>
    

    This is what I was expecting

    This is what I was expecting. I tried hard not to touch the code written by devs, but it seemed like there was no other way this would work.