Skip to content

Commit

Permalink
appium scroll deprecated update
Browse files Browse the repository at this point in the history
  • Loading branch information
MathisSenicourt committed Jan 14, 2025
1 parent 19f25be commit ffeedc7
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -494,11 +494,17 @@ private boolean scrollDown(TestCaseExecution testCaseExecution, By element, int
return false;
}

private void scroll(AppiumDriver driver, int fromX, int fromY, int toX, int toY) {

TouchAction touchAction = new TouchAction((PerformsTouchActions) driver);
touchAction.longPress(PointOption.point(fromX, fromY)).moveTo(PointOption.point(toX, toY)).release().perform();

private void scroll(AppiumDriver driver, int fromX, int fromY, int toX, int toY) { //#FIXME SELENIUM #TEST (I assume this method is working but the calling methods are crashing in previous versions already)
PointerInput finger = new PointerInput(PointerInput.Kind.TOUCH, "finger");
Sequence scrollSequence = new Sequence(finger, 0);
scrollSequence.addAction(finger.createPointerMove(
Duration.ofMillis(0), PointerInput.Origin.viewport(), fromX, fromY));
scrollSequence.addAction(finger.createPointerDown(PointerInput.MouseButton.LEFT.asArg()));
scrollSequence.addAction(finger.createPointerMove(
Duration.ofMillis(1000), PointerInput.Origin.viewport(), toX, toY));
scrollSequence.addAction(finger.createPointerUp(PointerInput.MouseButton.LEFT.asArg()));

driver.perform(List.of(scrollSequence));
}

public abstract String executeCommandString(Session session, String cmd, String args) throws IllegalArgumentException, JSONException;
Expand Down

0 comments on commit ffeedc7

Please sign in to comment.