Appium tests (iOS). Children of a XCUIElementTypeTable do not show, also the table has elements

I am automating my tests using appium. For this, I set the AutomationId of elements, and reference these in the tests.

But now I have a structure like this:

<ListView x:Name = "ResultList" ItemsSource="{Binding CurrentResults}" SelectedItem="{Binding CurrentSelection, Mode=TwoWay}" IsPullToRefreshEnabled="True">
       <ListView.ItemTemplate>
         <DataTemplate>
           <ViewCell>
             <Label Text="SomeText" AutomationId="AUTOMATE"/>
            </ViewCell>
         </DataTemplate>
       </ListView.ItemTemplate>
</ListView>

And in the output of appium inspector, I just see:

<XCUIElementTypeTable>

Without any children!
Why? How can I get the children to show up in appium inspector?

Thanks!

Tagged:

Answers

  • EliasNawfalEliasNawfal USMember
    edited October 25

    Your post helped me a lot so let me return the favor.

    You need to set Control.IsAccessibilityElement to true in a custom renderer or create an effect to be able to see items in Appium Inspector

        protected override void OnElementChanged(ElementChangedEventArgs<Image> e)
        {
            base.OnElementChanged(e);
            if (Control == null)
            {
                return;
            }
            Control.IsAccessibilityElement = true;
        }
    

    After this, you can find them by Id

  • RudolfVonKrugsteinRudolfVonKrugstein DEMember ✭✭

    Hey EliasNawfal,

    Thank you very much, but unfortunately I still cannot get it to work even with your code.
    What kind of elements are you using? Are they in a ListView? Because I believe that is the problem. Which Element are you setting IsAccessibilityElement on?

    Thanks!
    Nathan

  • EliasNawfalEliasNawfal USMember
    edited October 27

    I have a ViewCell in a ListView, where I have an Image with a TapGestureRecognizer on it. The Image was not accessible by Appium so I created a CustomRenderer for the Image with the code above and it worked.
    After this you can use the AutomationId _driver.FindElementById("AUTOMATE")

  • RudolfVonKrugsteinRudolfVonKrugstein DEMember ✭✭

    Hey,

    Thanks for the Help @EliasNawfal. I reported a bug for my Problem: https://bugzilla.xamarin.com/show_bug.cgi?id=60429

    Best Regards,
    Nathan

Sign In or Register to comment.