/** * @see TouchShortcuts#swipe(int, int, int, int, int) * @param startx Starting X position of a swipe * @param starty Starting Y position of a swipe * @param endx Ending X position of a swipe * @param endy Ending Y position of a swipe * @param duration Duration of a tap */ public void swipe(int startx, int starty, int endx, int endy, int duration) { this.driver.swipe(startx, starty, endx, endy, duration); }
@Override public void swipe(int startx, int starty, int endx, int endy, int duration) { ((AppiumDriver<?>) getWrappedDriver()).swipe(startx, starty, endx, endy, duration); }
public void swipeLeft() { AppiumDriver appiumDriver = (AppiumDriver) driver; appiumDriver.context("NATIVE_APP"); Dimension size = appiumDriver.manage().window().getSize(); int startx = (int) (size.width * 0.8); int endx = (int) (size.width * 0.20); int starty = size.height / 2; appiumDriver.swipe(startx, starty, endx, starty, 1000); }
public void swipeRight() { AppiumDriver appiumDriver = (AppiumDriver) driver; appiumDriver.context("NATIVE_APP"); Dimension size = appiumDriver.manage().window().getSize(); int endx= (int) (size.width * 0.8); int startx = (int) (size.width * 0.20); int starty = size.height / 2; appiumDriver.swipe(startx, starty, endx, starty, 1000); }
int y = location.getY(); LOG.debug("Swipe parameters: location {}, dimension {}, direction {}, time {}", location, size, direction, time); PageFactory.getMobileDriver().swipe(x + startx, y + starty, x + endx, y + endy, time);
protected void swipeDown(Point rootLocation, Dimension rootSize, int duration, float topPad, float bottomPad) { int offset = 1; int topOffset = Math.round(rootSize.getHeight() * topPad); int bottomOffset = Math.round(rootSize.getHeight() * bottomPad); Point center = new Point(rootLocation.x + rootSize.getWidth() / 2, rootLocation.y + rootSize.getHeight() / 2); logger.debug("Swiping down at" + " x1: " + center.getX() + " y1:" + (rootLocation.getY() + topOffset) + " x2:" + center.getX() + " y2:" + (rootLocation.getY() + rootSize.getHeight() - bottomOffset + offset)); driver.swipe(center.getX(), (rootLocation.getY() + topOffset), center.getX(), (rootLocation.getY() + rootSize.getHeight() - bottomOffset + offset), duration); }
protected void swipeUp(Point rootLocation, Dimension rootSize, int duration, float topPad, float bottomPad) { int offset = 1; int topOffset = Math.round(rootSize.getHeight() * topPad); int bottomOffset = Math.round(rootSize.getHeight() * bottomPad); Point center = new Point(rootLocation.x + rootSize.getWidth() / 2, rootLocation.y + rootSize.getHeight() / 2); logger.debug("Swiping up at" + " x1: " + center.getX() + " y1:" + (rootLocation.getY() + rootSize.getHeight() - bottomOffset + offset) + " x2:" + center.getX() + " y2:" + (rootLocation.getY() + topOffset)); driver.swipe(center.getX(), rootLocation.getY() + rootSize.getHeight() - bottomOffset + offset, center.getX(), rootLocation.getY() + topOffset, duration); }
protected void swipeLeft(Point rootLocation, Dimension rootSize, int duration, float leftPad, float rightPad) { int offset = 1; int leftOffset = Math.round(rootSize.getWidth() * leftPad); int rightOffset = Math.round(rootSize.getWidth() * rightPad); Point center = new Point(rootLocation.x + rootSize.getWidth() / 2, rootLocation.y + rootSize.getHeight() / 2); logger.debug("Swiping left at" + " x1: " + (rootLocation.getX() + rootSize.getWidth() - rightOffset + offset) + " y1:" + center.getY() + " x2:" + (rootLocation.getX() + leftOffset) + " y2:" + center.getY()); driver.swipe((rootLocation.getX() + rootSize.getWidth() - rightOffset + offset), center.getY(), (rootLocation.getX() + leftOffset), center.getY(), duration); }
protected void swipeRight(Point rootLocation, Dimension rootSize, int duration, float leftPad, float rightPad) { int offset = 1; int leftOffset = Math.round(rootSize.getWidth() * leftPad); int rightOffset = Math.round(rootSize.getWidth() * rightPad); Point center = new Point(rootLocation.x + rootSize.getWidth() / 2, rootLocation.y + rootSize.getHeight() / 2); logger.debug("Swiping right at" + " x1: " + (rootLocation.getX() + leftOffset) + " y1:" + center.getY() + " x2:" + (rootLocation.getX() + rootSize.getWidth() - rightOffset + offset) + " y2:" + center.getY()); driver.swipe((rootLocation.getX() + leftOffset), center.getY(), (rootLocation.getX() + rootSize.getWidth() - rightOffset + offset), center.getY(), duration); }
public void turnPageLeft() throws InterruptedException { acceptBadVideoAlert(); Dimension size = driver.manage().window().getSize(); int startX = (int) (size.width * START_OFFSET); int endX = (int) (size.width * END_OFFSET); int startY = size.height / 4; driver.swipe(startX, startY, endX, startY, SWIPE_DURATION); acceptBadVideoAlert(); }