PerformsTouchActions performsTouchActions = (PerformsTouchActions) driver;
// Get the size of the screen
Dimension size = driver.manage().window().getSize();
// Set the starting and ending coordinates for the swipe action
int startX = size.width / 2;
int startY = (int) (size.height * 0.8);
int endY = (int) (size.height * -0.1);
// Perform the swipe action
TouchAction touchAction = new TouchAction(performsTouchActions);
touchAction.press(PointOption.point(startX, startY))
.moveTo(PointOption.point(startX, endY))
.release()
.perform();
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter