question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Appium takes too long to find elements (iOS)

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:17

github_iconTop GitHub Comments

1reaction
sandaliqbal1commented, Nov 12, 2019

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

0reactions
emZubaircommented, Sep 30, 2020

Why are these issues getting closed while problem isn’t solved?

I haven’t found one solution to slow ios testing, where can I find a solution because none of these work The useFirstMatch is not recognized by Appium

@vzenzo in iOS element is searched from top to bottom in the XML tree, so whenever the first match is found it returns that element so userFirstMatch is the default behaviour in iOS. The main issue remains in place, in case of large XML it is quite slow to find the element.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Appium for iOS takes too long to find an element on a screen ...
I'm trying to find an element on a screen of an iOS native app which is an overlay that displays these components:.
Read more >
element.findElements() is slower than driver ... - Appium Discuss
The pages are heavy. So, some findElement() call is even taking around 40 seconds despite using ios class chain. So, my aim is...
Read more >
Appium extremely slow on some screens - Issues/Bugs
Appium desktop and test execution is extremely slow on list pages. get the page source command takes more than 1 minute. I made...
Read more >
Android - Appium takes a long time to search for elements
Even when the element is visible on the page already, it took like 2 minutes for Appium to find and interact with it....
Read more >
Very slow test runs on iOS simulator - Support - Appium Discuss
Hi, Please help me to find out the reason why the test runs on the iOS simulator became so slow. This is the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found