Yaniv Eliav Yaniv Eliav - 12 days ago 6x
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.


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


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.