Xamarin forms element not visible in inspect.exe UI automation tree yet can view properties on hover

58 Views Asked by At

So I'm using WinAppDriver to automate the testing of a UWP application written with Xamarin Forms and I am using to inspect.exe to make sure that the AutomationID property is being set properly on all the elements I am accessing, however, there is one particular button element that is being very peculiar. This button does not show up in the UI Automation tree in inspect.exe yet whenever I hover with inspect it can show all of its properties as exepcted.

Here's some details about the buttons weird behavior: The button always exists in the ui of the app The button in question in the ui

The button is able to be inspected by hover with inspect.exe and in the inspect details it shows that it is a child of the expected parent but it does not always show up in the tree meaning I can't always access it with WinAppDriver inspect.exe hover details showing it is getting the correct element and has the automationID I gave it

UI tree. The parent element is circled in red and the question mark points to where the element is supposed to exist

AddNew button's ancestors. It is an ancestor of the correct parent element

XAML Code for the button:

<Button
Text="{Binding [EntityChoiceViewBackAddNew], Source={x:Static i18n:Translator.Instance}}"
x:Name="AddNew"
AutomationId="AddNew"
AutomationProperties.IsInAccessibleTree="True"
AutomationProperties.Name="AddNew"
Margin="0,0,8,0" VerticalOptions="Center"
Padding="6,0,6,0"
Grid.Row="0" Grid.Column="1"
FontSize="14"
FontAttributes="Bold"
Command="{Binding Path=AddCommand}"
IsVisible="{Binding Path=CanAdd}"
HeightRequest="{OnPlatform iOS=42, Default=36}"
PropertyChanged="AddNewButton_PropertyChanged">

Things I've tried that didn't work:

  1. Starting a desktop session in winappdriver
  2. try to find it by it's full xpath, its name
  3. getting the child elements of it's parent and trying to find it from there
  4. Adding AutomationProperties.IsInAccessibleTree property
  5. Setting IsVisible to always true

Anyone have any insight in to how to get this element to display in the tree or a workaround in winappdriver?

0

There are 0 best solutions below