首页 > 解决方案 > 如何滚动到“手表部分”Appium

问题描述

我的滚动条一直滚动到底部。

但我需要向下滚动到“手表部分”,我无法执行。

    loginpage.getMensFashionList().click();//clicks on Mens Fashion
    //Scroll to watches section.
    driver.findElementByAndroidUIAutomator("new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().textMatches(\"Watches\").instance(0))");

点击男士时尚后,我需要滚动到手表部分,因为我对手表很感兴趣。

下面是手表部分的图片: 在此处输入图像描述

需要帮助才能滚动到手表部分。

用户界面自动化

标签: javaappium

解决方案


driver.findElement(MobileBy.AndroidUIAutomator(
                "new UiScrollable(new UiSelector().resourceId(\"your scrollable list id\")).scrollIntoView("
                + "new UiSelector().textContains(\"Watches\").instance(1))"));

推荐阅读