我已经尝试过在android设备上实现swipe方法,但是这个方法在Appium 1.3.4中不起作用。下面是我编写的代码:
public void swipe() {
JavascriptExecutor js = (JavascriptExecutor) driver;
HashMap < String, Double > swipeObject = new HashMap < String, Double > ();
swipeObject.put("startX", 0.95);
swipeObject.put("startY", 0.5);
swipeObject.put("endX", 0.05);
swipeObject.put("endY", 0.5);
swipeObject.put("duration", 1.0);
js.executeScript("emulator: swipe", swipeObject);
}
并调用该类中所需位置的swipe()。它引发的错误消息如下:
org.openqa.selenium.WebDriverException:尚未实现。请帮助我们:http://appium.io/get-involved.html (警告:服务器没有提供任何堆栈跟踪信息)命令持续时间或超时:7毫秒
请大家在这个问题上帮助我。谢谢
发布于 2015-03-23 02:05:41
您应该将操作方法迁移到TouchAction类,如果需要滑动,请尝试如下:
def swipe(start_x, start_y, end_x, end_y)
Appium::TouchAction.new.press(x: start_x, y: start_y).wait(1000).move_to(x:end_x, y:end_y).wait(500).release(x: end_x, y: end_y).perform
end
在这里检查API:http://appium.github.io/java-client/io/appium/java_client/TouchAction.html
除了协调之外,您还可以传递元素。
https://sqa.stackexchange.com/questions/11980
复制相似问题