Hi,
I am trying to swipe up the screen and select the last element available in the screen. For the same, here is my code snippet:
public class Exercise {
@Test
public void test() throws MalformedURLException {
DesiredCapabilities cap= new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.ANDROID);
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Device");
cap.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.app.package");
cap.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.app.activity");
AndroidDriver driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"),cap);
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
MobileElement songselection = (MobileElement) driver.findElementByAndroidUIAutomator("new UiSelector().text(\"songs)\")");
songselection.swipe(SwipeElementDirection.UP, 2000);
}
}
This script swipes the screen only to half. When I tried increased the value in the swipe function to 15000, screen scrolled up to the same half but with a varying speed.
Could you someone share your thoughts on this. Are there any new methods similar to ScrollTo available now.