UIAutomator - How to click the menu item 解决在listview中找不到item的问题

解决在listview中找不到item的问题

ArrayList<UiObject2> menu = (ArrayList<UiObject2>) this.mDevice.findObject(By.clazz("android.widget.ListView")).getChildren();

/* click the menu item at index 0 */
UiObject2 menu_action = menu.get(0);
if (menu_action != null && menu_action.isClickable()) {
    
    
    menu_action.click();
    menu_action.recycle();
} else {
    
    
    Assert.fail();
}

猜你喜欢

转载自blog.csdn.net/lean99682/article/details/109154852