繁体   English   中英

如何使用Appium在iOS设备上执行左键滑动

[英]How to perform Swipe left on iOS device using Appium

我想使用appium在特定的xpath上执行滑动。 无论如何我能做到。

在此输入图像描述

对于上述场景,请执行以下操作:

WebElement elem = driver.findElementByXPath("//ur elem xpath");
int x = elem.getLocation().getX();
int y = elem.getLocation().getY();

TouchAction action = new TouchAction(driver);
 action.longPress(x+5,y+5).waitAction(3000).moveTo(100,0).perform().release();

让我知道发生什么事

@noor这对我有用

JavascriptExecutor js = (JavascriptExecutor) driver;
    HashMap<String, Double> swipeObject = new HashMap<String, Double>();
        swipeObject.put("startX", 279.2);
        swipeObject.put("startY", 93.1);
        swipeObject.put("endX", 136.1);
        swipeObject.put("endY", 92.6);
        swipeObject.put("duration", 3.0);
        js.executeScript("mobile: flick", swipeObject);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM