【问题标题】:List of elements is shaking while scrolling in iOS在 iOS 中滚动时元素列表在晃动
【发布时间】:2022-08-16 05:22:49
【问题描述】:

我正在尝试滚动我的国家/地区列表以查找特定国家/地区,并且在第一次尝试后列表正在晃动,这会提供错误。

带有应用行为的视频:

https://youtube.com/shorts/6SOI4YQbJlk?feature=share 1

代码:

public void tapOnElementByText(String element) {
    HashMap<String, Object> scrollObject = new HashMap<>();
    JavascriptExecutor js = driver;

    scrollObject.put(\"direction\", \"down\");
    js.executeScript(\"mobile: scroll\", scrollObject);
    try {
        driver.findElementByIosNsPredicate(\"label == \\\"\" + element + \"\\\"\").click();
    } catch (NoSuchElementException exception) {
        System.out.println(\"Element not found\");
    }
}

我尝试了 stackoverflow 和 appium 教程(http://appium.io/docs/en/writing-running-appium/tutorial/swipe-tutorial/)中的各种东西,但对我没有帮助

    标签: java ios appium automation-testing


    【解决方案1】:

    我认为您正在使用的滚动条只是滑动,因此并没有真正受到控制。另外,当您执行 FindElementByXYZ 时,我认为限制为 50 项,因此如果您在滚动后寻找以 Z 开头的国家/地区,它仍然可能找不到。

    由于您有一个搜索框,您是否可以只输入您想要的国家名称,甚至只输入前几个字符,然后从生成的缩短列表中进行选择?

    我在我测试的应用程序中做了类似的事情,这种策略效果很好。

    【讨论】:

      猜你喜欢
      • 2011-05-26
      • 1970-01-01
      • 2012-03-31
      • 1970-01-01
      • 2014-03-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-29
      • 2015-11-17
      相关资源
      最近更新 更多