Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to scroll to a element which is not visible in appium?

Tags:

appium

In the previous version of Appium, I can use scroll functions to scroll to the particular element which is not visible on the screen.

My requirement is I have a Layout, in which many elements are there and that layout is scrollable. The element which I want to click is not visible on the screen and I have to scroll to a particular element and click that?

Can someone help me out on this issue how to scroll to the particular element?

like image 890
Anu699 Avatar asked Jan 19 '26 14:01

Anu699


1 Answers

In latest version of appium to scroll on the screen or to scroll the tables or to implement drag and drop functionalites we have to use TouchAction.

If we want to scroll in a scrollable layout first we have to get the bounds of that layout and give the coordinates in side that bounds.

Consider the below line of code.

new TouchAction(driver).press(300,200).moveTo(300,100).release().perform();

In this line of code we will perform the scroll down by 100 points.

.press(300,200) // Start at 300,200
.moveTo(0,100) // Increase Y by 300, ending up at 300,100

You have to pass the coordinates based on your requirements.

Find the details in below link:

https://appium.io/docs/en/writing-running-appium/touch-actions/

like image 154
SaiPawan Avatar answered Jan 23 '26 19:01

SaiPawan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!