I need help getting Android to Scroll using Javascript WD and Appium
On IOS I have no problem using this command.
await driver.execute(“mobile: scroll”, { direction: “down” });
On Android I have tried all the touch actions in the appium documentation for WD javascript and have not had any success. Any help would be appreciated.
Thanks
try this
Dimension dim = driver.manage().window().getSize();
int height = dim.getHeight();
int width = dim.getWidth();
int x = width / 2;
int top_y;
int bottom_y;
if (sDirectionUpDown.equalsIgnoreCase(“up”)) {
top_y = ( int ) (height * 0.80);
bottom_y = ( int ) (height * 0.50);
} else {
// Reversing
top_y = ( int ) (height * 0.50);
bottom_y = ( int ) (height * 0.80);
}
System. out .println(“coordinates :” + x + " " + top_y + " " + bottom_y);
TouchAction ts = new TouchAction(driver);
ts.press( new PointOption().withCoordinates(x, top_y)).waitAction(WaitOptions. waitOptions (Duration. ofMillis (2000))).moveTo( new PointOption().withCoordinates(x, bottom_y)).release().perform();
Thank You for your feedback, I believe this code is JAVA though and I am trying to figure it out with WD javascript.
I have tried things like this
where
Touch Perform works but does not scroll
http://appium.io/docs/en/commands/interactions/touch/touch-perform/
let action = new wd.TouchAction();
action.press({ x: 10, y: 10 });
action.moveTo({ x: 10, y: 1000 });
action.release();
below line needs to be commented out
// await action.perform();
Anyone have any success with this ?