Hi,
I am looking for a general scroll method for IOS and Android.
It should be able to work on hybrid, native and web apps.
Looking forward for comments.
created
Jun '18
last reply
Jun '18
- 2
replies
- 201
views
- 2
users
Hi,
I am looking for a general scroll method for IOS and Android.
It should be able to work on hybrid, native and web apps.
Looking forward for comments.
public static void scrollFullScreenDown() {
switch (getPlatform()) {
case IOS: {
Dimension size = getIOSDriver().manage().window().getSize();
TouchAction scroll = new TouchAction(getIOSDriver());
int startx = size.getWidth() / 2;
int starty = (int) (size.getHeight() * 0.8);
scroll.press(startx, starty).moveTo(0, (starty * -1)).release().perform();
}
break;
case Android: {
Dimension size = getAndroidDriver().manage().window().getSize();
TouchAction scroll = new TouchAction(getAndroidDriver());
int startx = size.getWidth() / 2;
int starty = (int) (size.getHeight() * 0.8);
scroll.press(startx, starty).moveTo(startx, (starty * -1)).release().perform();
}
break;
}
}