[automator篇][9] 列表,找孩子

private boolean ClickByCollInfo(int CLICK, String classname, String id, String text) {

        UiSelector uiselector = null;
        UiCollection musicList = null;
        switch (CLICK)
        {
            case CLICK_CLASS:
                musicList = new UiCollection(new UiSelector().className(classname));
                uiselector = new UiSelector().resourceId(id).text(text);
                break;
            default:
                return false;
        }
        UiObject uiobject = null;
        try {
             uiobject = musicList.getChild(uiselector);
        } catch (UiObjectNotFoundException e) {
            e.printStackTrace();
        }
        int i = 0;
        if(!uiobject.exists()) return false;
        try {
            uiobject.click();
        } catch (UiObjectNotFoundException e) {
            e.printStackTrace();
        }
        return true;
    }

  

posted @ 2017-05-15 19:33  liuzhipenglove  阅读(121)  评论(0编辑  收藏  举报