Reputation: 1
I have used the below method but it shows error on Swipe()
method. This method is not available in driver class. So, please suggest if any other way we can scroll in iOS Appium v1.7.2
.
Dimension size = driver.manage().window().getSize();
int x = size.getWidth() / 2;
int starty = (int) (size.getHeight() * 0.60);
int endy = (int) (size.getHeight() * 0.10);
driver.swipe(x, starty, x, endy, 2000);
Upvotes: 0
Views: 509
Reputation: 1194
For latest versions of appium you cannot use .swipe()
because this method is deprecated.You have to achieve the scroll functionality in latest appium using TouchAction
class.
Please refer the below link on Touch Actions :
Upvotes: 1
Reputation: 1
You can use the below method,
/**
* Swipe vertically upwards
*
* @author xxx
*
* @param ele
* -reference field/area to swipe
*
*/
public void verticalSwipe_Up(MobileElement ele) {
Dimension size = ele.getSize();
ElementOption press = element(ele, size.width / 2, (int) (size.height * .80));
ElementOption move = element(ele, size.width / 2, 25);
TouchAction swipe = new TouchAction(getDriver()).press(press).waitAction(waitOptions(Duration.ofMillis(1000))).moveTo(move).release();
// ofSeconds(2)
swipe.perform();
}
You can change the values accordingly to perform swipe down/right/left
Upvotes: 0