appium-java-client-7.0.0,滑动需要注意的问题
依赖:
io.appium
java-client
7.0.0
swipe不能使用,需要使用TouchAction进行滑动,首先我们要明确模拟器的坐标,经过我测试查看,模拟器的最左上角坐标是(0,0),横向X增大,纵向像下Y增大。
int width = appiumDriver.manage().window().getSize().width; 获取屏幕的宽
int height = appiumDriver.manage().window().getSize().height; 获取屏幕的长
PointOption pointOption= PointOption.point(width/2, height*3/4); 这里相当于一个坐标原点
TouchAction touchAction = new TouchAction(appiumDriver);
touchAction.press(pointOption).moveTo(PointOption.point(width/2,height/4)).release().perform();
·release 意思相当于放开
·perform 相当于发送执行
到这里我们会发现,没办法执行滑动ÿ