How to automate scrolling feature in IOS/Android using Appium tool | Mobile Testing

How to automate scrolling feature in Mobiles( IOS/Android)  using Appium tool for mobile testing?

Initially, Appium tool developers came up with below two methods to scroll down to the particular element in Mobiles

driver.scrollTo(String text); and driver.scrollToExact(String text);

But however, they have deprecated this feature from Version.

So with this depreciation,  automating scrolling functionality with appium turns to be tedious task,

Below is the simple code that helps to scroll using Appium in both android and iOS mobile application testing- It scrolls until an element with XPath is found.

Note: Keep in mind for iOS is that the XPath should also contain visible property along.

Use swipe method Keep start x and end x value constant and change start y and end y values to scroll up or down

swipe Method Syntax –

swipe(intstartx, intstarty, intendx, intendy, int duration) – Convenience method for swiping across the screen.

Below is the code to scroll till element present in the particular page

You need to observe the swipes carefully. It may be bit slow but work for sure.

Want to see more practical examples of Mobile automation features??

Please do enroll in my Mobile testing with Appium– online training and get Mastered in Mobile automation Technology

Leave a Reply

Your email address will not be published. Required fields are marked *