public void testLogin() throws UiObjectNotFoundException { UiObject validation = new UiObject(new UiSelector().packageName("com.jingdong.app.mall")); assertTrue(validation.waitForExists(5000)); UiScrollable pager = new UiScrollable(new UiSelector().resourceId("com.jingdong.app.mall:id/viewpager")); if (pager.waitForExists(3000)) { pager.setAsHorizontalList(); pager.scrollToEnd(4); UiObject startup = new UiObject(new UiSelector().resourceId("com.jingdong.app.mall:id/btn_experience")); startup.click(); } UiObject my = new UiObject( new UiSelector() .resourceId("com.jingdong.app.mall:id/bottomMenu") .childSelector(new UiSelector().className(RadioButton.class).index(4))); my.waitForExists(8000); my.click(); my.click(); UiObject login = new UiObject( new UiSelector().resourceId("com.jingdong.app.mall:id/personal_click_for_login")); login.clickAndWaitForNewWindow(); UiObject username = new UiObject(new UiSelector().resourceId("com.jingdong.app.mall:id/login_input_name")); username.setText("18824238317"); UiObject password = new UiObject(new UiSelector().resourceId("com.jingdong.app.mall:id/login_input_password")); password.setText("ztemt123"); UiObject loginbtn = new UiObject(new UiSelector().resourceId("com.jingdong.app.mall:id/login_comfirm_button")); loginbtn.click(); }
public void testLogin() throws UiObjectNotFoundException { UiObject validation = new UiObject(new UiSelector().packageName("com.chaozh.iReader")); assertTrue(validation.waitForExists(5000)); UiObject confirm = new UiObject( new UiSelector().resourceId("com.chaozh.iReader:id/defualt_compoundButton").text("确定")); if (confirm.waitForExists(3000)) { confirm.click(); } UiScrollable pager = new UiScrollable(new UiSelector().resourceId("com.chaozh.iReader:id/viewpager")); if (pager.exists()) { pager.setAsHorizontalList(); pager.scrollToEnd(1); UiObject startup = new UiObject(new UiSelector().resourceId("com.chaozh.iReader:id/btn_start")); startup.click(); } UiObject center = new UiObject(new UiSelector().resourceId("com.chaozh.iReader:id/bookShelf_head_Center_ID")); center.click(); center.click(); UiObject left = new UiObject(new UiSelector().resourceId("com.chaozh.iReader:id/bookShelf_head_left_ID")); left.click(); UiObject login = new UiObject(new UiSelector().resourceId("com.chaozh.iReader:id/person_longin")); login.clickAndWaitForNewWindow(); UiObject ireader = new UiObject( new UiSelector() .resourceId("com.chaozh.iReader:id/account_main_thirdlogin") .childSelector( new UiSelector() .index(0) .childSelector( new UiSelector() .index(1) .childSelector( new UiSelector() .index(1) .childSelector(new UiSelector().index(0)))))); ireader.clickAndWaitForNewWindow(); UiObject username = new UiObject( new UiSelector() .resourceId("com.chaozh.iReader:id/account_block_zhangyueid_login_name")); username.setText("18824238317"); UiObject password = new UiObject( new UiSelector() .resourceId("com.chaozh.iReader:id/account_block_zhangyueid_login_password")); password.setText("ztemt123"); UiObject loginbtn = new UiObject( new UiSelector() .resourceId("com.chaozh.iReader:id/account_block_zhangyueid_login_submit")); loginbtn.click(); }