[英]How to use swipe in appium javaclient 7.0?
我正在使用Appium java client 7.0
,但我确实意识到driver.swipe()
已被贬值,我尝试了Touchactions
&using Javascript executer
Touchactions
,似乎也不起作用
有人可以告诉我如何滑动屏幕吗(如果您已经在7.0中试用过,并且任何方法都适用于任何人)?
您现在应该使用TouchAction
类执行滑动操作。 水平检查滑动图库图库示例:
import io.appium.java_client.TouchAction;
...
AndroidElement gallery = driver.findElementById("io.appium.android.apis:id/gallery");
List<MobileElement> images = gallery
.findElementsByClassName("android.widget.ImageView");
int originalImageCount = images.size();
Point location = gallery.getLocation();
Point center = gallery.getCenter();
TouchAction swipe = new TouchAction(driver)
.press(element(images.get(2),-10, center.y - location.y))
.waitAction(waitOptions(ofSeconds(2)))
.moveTo(element(gallery,10,center.y - location.y))
.release();
swipe.perform();
从Java Client 6.1.0开始的Touch Actions方法支持
TouchAction ta = new TouchAction(driver);
ta.press(PointOption.point(207, 582)).moveTo(PointOption.point(8,
-360)).release().perform();
您需要指定从何处到需要滚动的x和y坐标,我希望这对您有用,因为这对我有用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.