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">
             <Label Text="SomeText" AutomationId="AUTOMATE"/>

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


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




  • 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)
            if (Control == null)
            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?


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

    Best Regards,

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

  • lanzelot1989lanzelot1989 ATMember ✭✭

    We are currently also facing this issue, where Appium only finds "list" or "Empty list" for an XCUIElementTypeTable and is not able to access the elements it contains.

    We are currently trying to set the container to inaccessible via the IsAccessibilityElement property, as described in this Appium issue.

    Was anybody else able to solve this in a different way?

  • ShreyasShenoyShreyasShenoy USMember

    Any updates on this one? We have been blocked for a long time due to this issue.

  • RudolfVonKrugsteinRudolfVonKrugstein DEMember ✭✭

    @lanzelot1989 Did you have any success with your approach? Can you share how you got it working?

  • lanzelot1989lanzelot1989 ATMember ✭✭

    Hi @RudolfVonKrugstein!

    Yes, we got it working with Appium by strictly following
    "If your application displays a custom view that contains other elements with which users interact, you need to make the contained elements separately accessible. At the same time, you need to make sure that the container view itself is not accessible. The reason is that users interact with the contents of the container, not with the container itself."

    However, this was only a partial success as we still have the problem now that identifiers are sometimes missing and are not displayed, seemingly by chance, which also complicates things a lot for us.

  • OctagonOctagon USMember ✭✭

    We recognized that, oddly, the second time Xamarin executes a read of the page content, the IsAccessibilityElement settings appeared to be honored and the child items in the XCUIElementTypeTable became accessible.

    Our test automation uses a slow and annoying procedural workaround whereby it enters, exits, and re-enters the target screen, at which point the table content (which was present in the first viewing as well) becomes recognized by Appium and can be manipulated with no further problems.

    Cursory research did not reveal a means to simply force the reload of the page with an Appium-specific instruction, which would have been a clear improvement upon the route we chose.

  • RudolfVonKrugsteinRudolfVonKrugstein DEMember ✭✭

    Anyone found a workaround for a TableView with sections?

  • OctagonOctagon USMember ✭✭

    The workaround stopped working for no apparent reason recently. We believe is is related to the timing of our update to Appium Desktop 1.6.1, which also offered drastic performance improvements.

    We can no longer see child elements in the ListView, so we have vastly improved performance but something like 85% failing tests now, as we have a serious dependency upon seeing elements within a ListView.

  • OctagonOctagon USMember ✭✭

    Apparently with the latest version of Appium (1.6.1 Desktop, 1.8.0 server), the IsAccessibilityElement property is being honored. By setting cell.IsAccessibilityElement = true as previously suggested (cell is UITableViewCell), we now seem to correctly parse the ListView.

    Best of all, the prior workaround is eliminated, which will cut test durations down.

Sign In or Register to comment.