Search code examples
javaselenium-webdriverappiumappium-android

Unable to scroll android native app with appium using java client 7.0


I am unable to scroll the android app vertically with Appium. I am using the java-client 7.0.0 API. Action.press is not working

(new TouchAction(driver))
  .press({x: 600, y: 2408})
  .moveTo({x: 348: y: 615})
  .release()
  .perform()

Solution

  • Try using the following as an example:

    /**
     * This method scrolls based upon the passed parameters
     * @author Bill Hileman
     * @param int startx - the starting x position
     * @param int starty - the starting y position
     * @param int endx - the ending x position
     * @param int endy - the ending y position
     */
    @SuppressWarnings("rawtypes")
    public void scroll(int startx, int starty, int endx, int endy) {
    
        TouchAction touchAction = new TouchAction(driver);
    
        touchAction.longPress(PointOption.point(startx, starty))
                   .moveTo(PointOption.point(endx, endy))
                   .release()
                   .perform();
    
    }