java - 运行 Appium 命令时出错 : string is not a function

标签 java scroll appium

我正在尝试使用 Java 滚动 Android 移动应用程序并尝试这些代码;

  JavascriptExecutor js = (JavascriptExecutor) driver;
    HashMap<String, String> scrollObject = new HashMap<String, String>();
    scrollObject.put("direction", "down");
    js.executeScript("mobile: scroll", scrollObject);

Eclipse 给出了这个错误:

Exception in thread "main" org.openqa.selenium.WebDriverException: ERROR running Appium command: string is not a function Command duration or timeout: 7 milliseconds

And Appium (version 1.4.16.1) Logs are ;

我也在使用 WebDriver。 我该如何解决这个错误?

最佳答案

语法:driver.swipe(startX, startY, endX, endY, 持续时间);

示例:

driver.swipe(200, 900, 200, 100, 2000);

关于java - 运行 Appium 命令时出错 : string is not a function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45876406/

相关文章:

java - 如何在文本中找到复合字符串

javascript - 如何在动画完成之前禁用滚动?

ios - 不滚动刷新 UITableview

html - 溢出 : scroll; CSS adding border to edge of page?

java - 如何使用 appium 和 java 向下滚动以单击 Android 中的元素?

java - 在 Android 应用程序上识别元素时可以使用边界(坐标)吗?

java - Yosemite : No compiler is provided in this environment 上的 Maven 安装失败

java - 调用泛型类型实例方法

java - 检查所有数组值是否不同

android - packageAndLaunchActivityFromManifest 失败 appium 错误