我试过在android中使用swipe方法,但它不起作用。
代码:-
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);
}
错误:-
org.openqa.selenium.WebDriverException: Not yet implemented.
非常感谢任何帮助。
最佳答案
将上下文更改为 NATIVE_APP
对我有用:
String originalContext = driver.getContext();
driver.context("NATIVE_APP");
driver.swipe(startx, starty, endx, endy, duration);
driver.context(originalContext );
关于android - android appium 不支持滑动方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29935366/