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 2017

    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

  • 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 2017

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

  • 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

  • OctagonOctagon USMember
    edited December 2017

    I'm interested in if/how this was resolved, as my team is seeing what seems to be the same issue. The Xamarin bug report listed above was closed due to no response from OP.

    We have added IsAccessibilityElement = true within our OnElementChanged() event handler, but this accomplished nothing, and Appium exposes only the XCUIElementTypeTable element and no items within the collection.

Sign In or Register to comment.