问题
I tried executing the swipe operation i.e. right to left swipe with the following method. I am getting the result as pass but the operation is not getting performed.
Can you guys check and let me know what coordinates I should keep in order to make this functional.
//Horizontal Swipe by percentages
public void horizontalSwipeByPercentage (double startPercentage, double endPercentage, double anchorPercentage, int duration) {
Dimension size = driver.manage().window().getSize();
int anchor = (int) (size.height * anchorPercentage);
int startPoint = (int) (size.width * startPercentage);
int endPoint = (int) (size.width * endPercentage);
new TouchAction(driver)
.press(point(startPoint, anchor))
.waitAction(waitOptions(ofMillis(1000)))
.moveTo(point(endPoint, anchor))
.release().perform();
}
public void horizontalSwipe()
{
horizontalSwipeByPercentage (0.9,0.01,0.5,3000);
}
Default test
Tests run: 1, Failures: 0, Skips: 0
===============================================
===============================================
Default suite
Total tests run: 1, Passes: 1, Failures: 0, Skips: 0
===============================================
来源:https://stackoverflow.com/questions/64604194/right-to-left-swipe-in-android-appium