Yaniv Eliav Yaniv Eliav - 1 month ago 13
Android Question

How to ScrollTo after ScrollTo and ScrollToExact were deprecated

I have noticed that the ScrollTo was deprecated, but didn't find any good solution to scrollTo any webelement on page.


Question:


can someone please help me figure out what's the best way to do that now in C#(Android device)?

Answer

To my understanding the only method you can use to scroll is

driver.swipe(int startx, int endx, int starty, int endy, int duration);

You can likely build a swipeTo function using the method above and the following methods:

driver.manage().window.size().getHeight() // and .getWidth()
//Note I am recalling that one from memory as I do not have access to my appium program currently
el.getLocation().getX() //getY()
el.getSize().getWidth() // getHeight()

With a little bit of math you can likely turn these into a swipeTo method.

Comments