iOS issue: Element found before swiping down


I’m having issue when trying to swipe to element which is not presented on screen, when using
TouchAction press(startX, startY).moveTo(endX, endY).release().perform();
driver.swipe(startX,endX,startY,endY); - with the old Java Client

The issue occurs only when Automating iOS devices, and the problem is that the Automation finds the Element before the swipe begins thus no need to swipe which is not the case and fails the test as a result.

I’m passing to every searched element @OnScreen = ‘true’ and real device dimensions to make sure I’m always looking for elements which are physically on screen, and still won’t work.
Needless to say that on Android everything runs smooth as silk :slight_smile:

Any suggestions guys?

BTW the App is always set to Instrumented = ‘true’ by default.


Hey @Liran, Those elements must be visible before swipe, have you checked current view xml? Those elements must be present in that xml, therefore appium shows them visible.
In this case you cannot verify element’s presence before/after swipe.

Hey @Swapan_Chhabra, Thanks for the reply.

My guess it’s mainly due to App’s being instrumented therefore all elements are visible, and because how iOS is built (layers) thus all elements presented on screen even the hidden ones.

So the question is how do you swipe to an element which is not presented on screen?


Nope @Liran Its not about iOS, its about your application. I have faced this kind of issue in an App, but its not same for all apps. Its how your application is built.

For this problem there’s a workaround!
You can try clicking on that element and can verify its expected behavior. If its not matched to expected behavior, you can assume it didn’t got visible on screen and then swipe again and do same verification.
Its not a solution but a workaround!