Quicker scripts with a huge iOS DOM

Hello there!

I’m facing an iOS app with a really really big DOM in some screens. The DOM is formed by XCUITest elements (using XCUITest automationName capability).

Generally the whole execution is slow on iOS, but in those heavy screens the execution gets EXTREMELLY slow… Often the session timeouts while locating some element and test crashes.

I know XPath location strategy is very low on iOS, but even looking for an id (By.id) find for an element is really slow. From Appium inspector the behavior is the same.

I suspect I’m not facing this situation correctly, so there goes a bunch of questions:

  • XCUITest is currently the best automation engine to use for iOS?
  • There exists some capability like Android’s ‘ignoreUnimportantViews’ for DOM preprocessing? (Truncating the DOM to only on screen elements for example)
  • Which is the best location strategy? I assume it’s looking for id.
  • Principal causes of slowness iOS scripts?
  • Any suggestion for get my scripts quicker?

I’m using Appium server 1.9 and a iOS 11 system on a real device if it helps.

Thank you!

Yes the only one

No, there is no such capability. XCUITest does not provide any information on which views are not important. Excluding elements by their visible attribute can bring multiple false positives

There are many

Read through the set of nice articles on Appium Pro dedicated to this topic. The first article can be found at Appium Pro: Making Your Appium Tests Fast and Reliable, Part 1: Test Flakiness

Helpful as always! Thank you mykola.

1 Like

@hamena with large page you can switch to NsPredicate strategy

https://developer.apple.com/documentation/foundation/nspredicate

http://appium.io/docs/en/writing-running-appium/ios/ios-predicate/

I’ll take a look, thank you Aleksei

What IF you supply a capability useJSONSource : True
I definitely noticed a lot of difference when using this flag in my tests, especially on iPads.
Goto for more details : https://github.com/appium/appium-xcuitest-driver