小编mc-*_*sm9的帖子

无法使用 Java 客户端使用 Appium 滚动 Android 应用程序

我无法使用 Appium 向下滚动到 Android 应用程序中任何页面的底部。尝试了多种方法,包括在 Stack Overflow 上找到的方法。(这个挑战似乎很常见。)然而,所有的尝试都失败了。

环境:

  • Appium 版本:1.6.2
  • Appium 客户端:Java (java-client-6.1.0.jar)
  • 安卓版本:5.1、6.0.1、7.1.1
  • Java版本:jre1.8.0_171
  • 硒版本:selenium-java-3.13.0
  • 应用类型:Cordova(混合);该应用程序是用 Cordova 构建的,但在运行时System.out.println(driver.getContext());,结果是NATIVE_APP

请分享可以解决此问题的任何替代方案或改进。非常感谢任何有用的建议!

以下总结了尝试的各种方法:

  1. 方法:scrollIntoView()(各种实现)
  2. driver.findElementByAndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView(resourceId(\"send-to-email-app\"));").click();
  • 来源:Udemy 课程
  • 错误:不滚动且没有错误

  • 方法:尝试 catch > scrollIntoView()
  • try { driver.findElementByAndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView(text(\"Send\"))"); }catch(Exception e) { System.out.println("We got an error scrolling!"); }
    • 来源:/sf/ask/2776103851/
    • 错误:部分有效:页面向下滚动但不够远

  • 方法:滑动
  • driver.swipe(0, Startpoint,0,scrollEnd,1000);
    • 来源:/sf/ask/2739141401/
    • 错误:不推荐使用滑动

  • 方法:touchAction.longPress + moveTo
  • ...touchAction.longPress(fromX, fromY).moveTo(toX, toY).release().perform();
    • 来源:/sf/ask/3099769221/
    • 错误:“无法解析驱动程序”

  • 方法:touchAction.longPress + moveTo
  • TouchAction touchAction = new TouchAction(driver); touchAction.longPress(10, 10).moveTo(x, y).release().perform();
    • 来源:/sf/ask/3099769221/
    • 错误:“TouchAction 类型中的 longPress(LongPressOptions) …

    java android scroll scrollview appium

    5
    推荐指数
    1
    解决办法
    5990
    查看次数

    标签 统计

    android ×1

    appium ×1

    java ×1

    scroll ×1

    scrollview ×1