appium: Appium takes too long to find elements (iOS)

The problem

When the page source is large, Appium takes a huge amount of time just to get one element on screen. As a result tests run very slow and a lot of times TimeOut Exceptions are thrown so the tests are not stable enough.

Environment

  • Appium version: 1.15.0
  • Operating system: Mac OS Mojave 10.14.5
  • Node version is 12.11.1
  • Mobile platform/version under test: iOS 13.2
  • Using iOS Simulator
  • Xcode version: 11.2

Details

In the app there is a scrolling list view, which is basically a search results page. The result list keeps populating in the background as data is returned, so the it keeps growing until the search is complete. This list reaches up-to 1000 results or even exceeds that sometimes. Another example is a Map view which has lots of points of interest shown as pins on the map. User can tap on a pin and it shows the relevant information.

On the Android side this is not an issue as only those elements are returned which are displayed on the screen. So even with a 1000+ results only 3-5 results are fetched which are visible on the screen. On iOS side Appium gets full page source and this includes all elements on the page (visible or invisible). The desktop version gets stuck on inspection page, keeps working to get page source and takes minutes and does not return proper XML. As a workaround I have tried using another app inspector (Macaca) which works but its only for inspection. Now after inspection and figuring out the proper locator strategy, when it comes to finding elements on screen none of the strategies help. I guess this is because Appium cannot get the page source in the first place so it cannot move forward to find elements on the page.

Locator strategies I have tried:

  • Accessibility ID
  • Class Name
  • iOS Predicate
  • iOS Class Chain
  • xPath (already not recommended)

Additional things that I have tried:

Link to Appium logs

https://gist.github.com/khubaib321/254b5c9d35f11fc0ebfc808aaf6b3c10

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 20

Most upvoted comments

@mykola-mokhnach it would be great if we could speed findElements on ios simulator at least as that makes test 2-3 times slower on ios than on android. Maybe an alternative better way of getting page source.