How can I scroll in android/ios from top to bottom using appium driver?

Hi Karunakaran, Could you pease share the code to retrieve the last element in the page?

Cheers,
Dev

When I login into an iOS App, in the next page, I have to click on a “Next” button in the bottom of that page .
For that I have to scroll down.
I have been trying to use the below code, but it isn’t working for me:

                    Dimension dimensions = driver.manage().window().getSize();
	    Double screenHeightStart = dimensions.getHeight() * 0.5;
	    int scrollStart = screenHeightStart.intValue();
	    System.out.println("s="+scrollStart);
	    Double screenHeightEnd = dimensions.getHeight() * 0.1;
	    int scrollEnd = screenHeightEnd.intValue();
	    for (int i = 0; i < dimensions.getHeight(); i++)
                    {
	    driver.swipe(0,scrollStart,0,scrollEnd,2000);
	    if (driver.findElement(By.id("Next")).isDisplayed()) 
	    	break;
                     }

Please help me with how to tackle this problem. It is scrolling upwards instead of down

Check with the version of java-client
Below dependency will solve your problem

io.appium java-client 3.2.0

Which version of Java client are you using?