无法在appium iOS测试上滑动 [英] Cannot swipe on appium iOS test
问题描述
在文档中,appium为java提供了以下选项:
In the documentation, appium presents the following option for java:
JavascriptExecutor js = (JavascriptExecutor) driver;
HashMap<String, Double> swipeObject = new HashMap<String, Double>();
swipeObject.put("startX", 0.01);
swipeObject.put("startY", 0.5);
swipeObject.put("endX", 0.95);
swipeObject.put("endY", 0.5);
swipeObject.put("duration", 1.8);
js.executeScript("mobile: swipe", swipeObject);
我在测试中将其集成,但导航到可以使用滑动的屏幕后,方法使用滑动不会执行操作...在失败例外面板中,我收到以下错误:org.openqa.selenium.WebDriverException:尚未实现。
I integrated this in my test, but after navigating to the screen where swipe would be available, the method with swipe won't perform the action... In the failure exception panel I receive the following error: "org.openqa.selenium.WebDriverException: Not yet implemented".
我想从左向右滑动,但还没有找到其他解决方案......
I want to swipe from left to right, but did not find another solution yet...
更新:
我设法使用以下代码进行滑动:
UPDATE: I have managed to swipe by using the following code:
HashMap scrollObject = new HashMap();{{
scrollObject.put("direction", "left");
}};
((RemoteWebDriver) driver).executeScript("mobile: scroll", scrollObject);
问题是,它只会刷一次,即使多次使用......任何想法关于如何解决这个问题?
The problem is, that it will only swipe once, even if used multiple times... any ideas on how to solve this?
推荐答案
如何使用IOSDriver(驱动程序)并调用以下内容:
How about using IOSDriver (driver) and calling the following:
driver.swipe(100, 100, 500, 500, 500);
这篇关于无法在appium iOS测试上滑动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!