android - android appium 不支持滑动方法

标签 android selenium appium

我试过在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/

相关文章:

android - Appium:为什么我在提供了所有相关值后仍会在日志中看到 desiredcapabilties 错误?

javascript - Google 图表 API 无法正常工作

android - 使用 intent 和 post 参数启动默认浏览器

python - 字符串对象不返回预期结果

python - Selenium,使用 Python,如何简化脚本以便我可以从其他 python 脚本运行它们?

selenium - 如何在下拉列表中滚动到隐藏元素?

android - 我的应用似乎停止了。我不知道我的错误

java - Firebase,类映射器 : no setter/field found for 'UserTwo' on class 'myclass'

java - 我可以使用 TestNG 中的 @Parameters 从用户定义的 xml 中读取而不是从 testng.xml 中读取吗

java - 使用线程概念java在多个设备中并行执行