I was getting some errors on “point”, “ofSeconds” and “waitOptions” so i have changed the code to this: and im calling it by swipeDown(1);
** scrollUp(1);**. But its not working so can you help?
public static void swipeDown(int howManySwipes) {
org.openqa.selenium.Dimension size = driver.manage().window().getSize();
// calculate coordinates for vertical swipe
int startVerticalY = (int) (size.height * 0.8);
int endVerticalY = (int) (size.height * 0.21);
int startVerticalX = (int) (size.width / 2.1);
try {
for (int i = 1; i <= howManySwipes; i++) {
new TouchAction<>(driver).press(point(startVerticalX, endVerticalY))
.waitAction(waitOptions(ofSeconds(2))).moveTo(point(startVerticalX, startVerticalY))
.release().perform();
}
} catch (Exception e) {
//print error or something
}
}
public static void scrollUp(int howManySwipes) {
org.openqa.selenium.Dimension size = driver.manage().window().getSize();
// calculate coordinates for vertical swipe
int startVerticalY = (int) (size.height * 0.8);
int endVerticalY = (int) (size.height * 0.21);
int startVerticalX = (int) (size.width / 2.1);
try {
for (int i = 1; i <= howManySwipes; i++) {
new TouchAction<>(driver).press(point(startVerticalX, startVerticalY))
.waitAction(waitOptions(ofSeconds(2))).moveTo(point(startVerticalX, endVerticalY)).release()
.perform();
}
} catch (Exception e) {
//print error or something
}
}
private static WaitOptions waitOptions(Object ofSeconds) {
// TODO Auto-generated method stub
return null;
}
private static Object ofSeconds(int i) {
// TODO Auto-generated method stub
return null;
}
private static PointOption point(int startVerticalX, int startVerticalY) {
// TODO Auto-generated method stub
return null;
}
}