Scrolling in appium

ScrollingScreen_AppiumScrolling on mobile handsets or handheld devices can be of up or down,

Scenario: some times elements can’t be identified as those are not visible on screen, but once we scroll down to make it visible, and then can be easily identified.

scrollTo() or scrollToExact() methods are deprecated from Java-client 4.0 version onwards… 

One of the way to achieve this is by using swipe() method (implemented from TouchShortcuts interface)

On native apps:

scrolling can be possible by swipe up or down on mobile screen.

swipe() accepts 5 arguments as mentioned detailed on our post swipe in appium.

NOTE: get the size of the device screen or size of the element on which scrolling needs to be done, so that same test code can be run across difference devices.

Code explanation –




Above script will scroll from top to bottom till it reaches to “Web View” option and then clicks on that option.

scrollingAppium

On java-client.jar version 5.0 on wards

swipe() method deprecated, one workaround to swipe is to use io.appium.java_client.TouchAction

From the above code, instead of

we can use

On android browser:

Above method will not work for android browser, so we need to use as usual selenium scroll using JavaScriptExecutor.

Short link – bit.ly/qav-apmScroll

Content posted is based on learning or working experience, Share the post with others if find useful, Any queries?, leave comments or discuss on our facebook:qavalidation.com, Thanks!

Leave a Reply

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

%d bloggers like this: