ListView Loading Issue

Hi Team,

We are trying to automate a Xamarin.Forms app in iOS through Appium.

Adding AutomationId alone isn`t enough to inspect ListView elements in the Appium.
We have added following property (AutomationProperties.IsInAccessibleTree=“False”) as mentioned in the below Xamarin Forum link.

Now, we are able to inspect ListView elements but we are facing another issue with respect to loading items in Listview.
When we click refresh in Appium, depending on the data/rows in ListView Appium takes more time to load ListView.
ListView is enabled with RetainElement as ListViewCachingStrategy and supported with Infinite Scrolling/Pagination.

On further analysis Appium seems to load all the data instead of trying to load only visible data in the Listview whereas in actual usage the infinite scroll triggers only after scrolling to the last item in the current avaialble data.

For instance: Let`s say only 5 rows are displayed in Listview. When we click refresh in Appium, it should try to load only 5 rows into it. Instead it tries to load all 20 rows of the first set.

Since infinite scroll is enabled,the next set/page/bucket of data should be fetched only when the last item has appeared or made visible by scrolling. As it is trying to load all the rows it automatically triggers the infinite scrolling to fetch the next set and it repeats until all the rows in the list are fetched.

This makes the UI unusable until all rows are loaded.

Would like to know if this is the expected behavior in Appium or any settings or work around in Appium/Xamarin could be suggested.

Thanks in Advance !!!..

Regards,
Saravana Pandian M.

this is valid for Android with UIAutomator. But not for iOS. XCUITest (iOS native framework which uses Appium) shows ALL.
You can see same using ‘Accessibility Inspector’ in xCode.

try reduce data. also you can limit element search with adding ‘visible == 1’ in predicate. https://appium.io/docs/en/writing-running-appium/ios/ios-predicate/

Hi Aleksei,

Thanks for your quick response. We will check and update you on the suggested workaround.

We have one more query on ListView Swipe Action,

Since swipe action element called MenuItem is part of ListView, we have tried to add the same ListView fix (AutomationProperties.IsInAccessibleTree=“False”) here also. But, it actually not working as we couldn`t see the AccessibilityIdentifier anywhere in that attributes List in Appium tool. Whatever value we have given in Text property only reflects in all attributes such as Name, XPath, Value and Label in Appium.

AutomationId value not reflecting in Appium for this swipe action case.

Code Snippet:

<ViewCell.ContextActions>
MenuItem x:Name=“menuItem” AutomationId="{Binding Name}" Text="{Binding Name}"
</ViewCell.ContextActions>

Another problem we are facing in this is,

If ListView has 10 swipe action buttons, we can inspect only one random swipe button in Appium whereas I can inspect all 10 swipe buttons in Accessibility Inspector in XCode.

Is this also the iOS native behavior or do you have any workaround for this either from Xamarin or Appium side ?

  1. About id - no idea. I am not iOS programmer. I used to work in native Swift code to add simple ids, a bit complicated accessible elements. Any harder work I am asking help of iOS developers. Do you see your ids ‘Accessibility Inspector’? If not - Appium will not see them also.
  2. I do not use Appium GUI tool. So can’t comment. I like just grab ‘driver.getPageSource()’ in code on needed screen and read it.

Okay Aleksei. Thanks for taking time to reply us.