Error log: org.openqa.selenium.WebDriverException: Not yet implemented. Please help us: http://appium.io/get-involved.html (WARNING: The server did not provide any stacktrace information)
Those coordinates depend on the size of your android. If you want to continue to use percentage you can use the following method:
public static void swipeHorizontal(AppiumDriver driver, double startPercentage, double finalPercentage, double anchorPercentage, int duration) throws Exception {
Dimension size = driver.manage().window().getSize();
int anchor = (int) (size.height * anchorPercentage);
int startPoint = (int) (size.width * startPercentage);
int endPoint = (int) (size.width * finalPercentage);
new TouchAction(driver).press(startPoint, anchor).waitAction(duration).moveTo(endPoint, anchor).release().perform();
//In documentation they mention moveTo coordinates are relative to initial ones, but thats not happening. When it does we need to use the function below
//new TouchAction(driver).press(startPoint, anchor).waitAction(duration).moveTo(endPoint-startPoint,0).release().perform();
}
And calling it with the value from your topic would be:
swipeHorizontal(driver,0.9,0.01,0.5,3000);
Notice the comments about absolute/relative values
As you said, it is the same format… You just exchange height for width
public static void swipeVertical(AppiumDriver driver, double startPercentage, double finalPercentage, double anchorPercentage, int duration) throws Exception {
Dimension size = driver.manage().window().getSize();
int anchor = (int) (size.width * anchorPercentage);
int startPoint = (int) (size.height * startPercentage);
int endPoint = (int) (size.height * finalPercentage);
new TouchAction(driver).press(anchor, startPoint).waitAction(duration).moveTo(anchor, endPoint).release().perform();
//In documentation they mention moveTo coordinates are relative to initial ones, but thats not happening. When it does we need to use the function below
//new TouchAction(driver).press(anchor, startPoint).waitAction(duration).moveTo(0,endPoint-startPoint).release().perform();
}
swipeVertical(driver,0.9,0.1,0.5,3000);
Hi @Telmo_Cardoso, i tried this code for Swipe Up, After running, the TestNG test result indicates passed but on the actual device is not swiped. Please Help me. Thanks