无法在 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屋!