/** * 编辑病例 * * @param age * @return */ public static String editCase(String age) { WebElement eEditBtn = driver.findElement(By.id(edit_case_btn)); eEditBtn.click(); WebElement eAgeYear = driver.findElement(By.id(age_year_input)); eAgeYear.clear(); eAgeYear.sendKeys(age); boolean flag = Utils.swipe(driver, By.id(pub_case), 2); if (flag) { WebElement eEditCase = driver.findElement(By.id(pub_case)); eEditCase.click(); } else { Assertion.assertEquals(true, flag, "发布按钮未找到,请检查后再试!"); } String terminalAge = ""; boolean findCaseAge = Utils.isElementExist(driver, By.id(terminal_age)); int num = 0; if (findCaseAge == false) { while (findCaseAge == false && num < 10) { findCaseAge = Utils.isElementExist(driver, By.id(terminal_age)); System.out.println(num); if (findCaseAge) { terminalAge = Utils.getText(driver, By.id(terminal_age)); } else { num++; } } } else { terminalAge = Utils.getText(driver, By.id(terminal_age)); } return terminalAge; }
@Test public void F_more() { // List<WebElement> editBox=driver.findElements(By.className("android.widget.TextView")); // editBox.get(3).click(); // driver.findElement(By.name("Collections")).click(); // driver.findElement(By.name("COOL!")).click(); List<WebElement> collection1 = driver.findElements(By.className("android.view.View")); // Taping on Collection folder collection1.get(5).click(); TouchAction tActionn = new TouchAction(driver); // Tap function tActionn.tap(150, 301).release().perform(); // driver.findElement(By.xpath("//*[@class='android.view.View' and @index='5']")).click(); driver.findElementByAccessibilityId("More").click(); driver.findElementByName("Info").click(); driver.findElement(By.id("com.mimedia.gallery:id/gallery_action_bar_nav_icon")).click(); driver.findElementByAccessibilityId("More").click(); driver.findElementByName("Add to Collection").click(); driver.findElement(By.id("com.mimedia.gallery:id/merged_collection_cover")).click(); driver.findElementByName("Add to Collection").click(); driver.findElementByAccessibilityId("More").click(); driver.findElementByName("Add to MiDrive").click(); List<WebElement> midrive = driver.findElements(By.className("android.widget.FrameLayout")); midrive.get(0).click(); // driver.findElement(By.xpath("//*[@class='android.widget.FrameLayout' and // @index='0']")).click(); driver.findElementByName("Add to MiDrive").click(); driver.findElementByAccessibilityId("More").click(); driver.findElementByName("Delete").click(); driver.findElementByName("Cancel").click(); driver.findElementByAccessibilityId("More").click(); driver.findElementByName("Delete").click(); driver.findElementByName("Delete").click(); driver.findElement(By.id("com.mimedia.gallery:id/gallery_action_bar_nav_icon")).click(); TouchAction tActionn1 = new TouchAction(driver); // Tap function tActionn1.tap(150, 301).release().perform(); WebDriver augmentedDriver = new Augmenter().augment(driver); // Landscape orientation ((Rotatable) augmentedDriver).rotate(ScreenOrientation.LANDSCAPE); // Landscape orientation WebDriver augmentedDriver1 = new Augmenter().augment(driver); // Landscape orientation ((Rotatable) augmentedDriver1).rotate(ScreenOrientation.PORTRAIT); for (int i = 0; i <= 0; i++) { driver .findElement(By.id("com.mimedia.gallery:id/gallery_action_bar_nav_icon")) .click(); // Back key twice } }
// ######## Check Login functionality/ throws InterruptedException########################### @Test public void A_login() { // navigation();sreens();more();sharing(); throws InterruptedException driver.findElement(By.xpath("//android.widget.Button[@text='MiMedia Login']")).click(); // driver.findElement(By.name("Email address")).sendKeys("*****@*****.**"); // .sendKeyEvent(47);driver.sendKeyEvent(29);driver.sendKeyEvent(49);driver.sendKeyEvent(46);driver.sendKeyEvent(29);driver.sendKeyEvent(50);driver.sendKeyEvent(7);driver.sendKeyEvent(11);driver.sendKeyEvent(39);driver.sendKeyEvent(49);driver.sendKeyEvent(41);driver.sendKeyEvent(29);driver.sendKeyEvent(46);driver.sendKeyEvent(77);driver.sendKeyEvent(35);driver.sendKeyEvent(41);driver.sendKeyEvent(29);driver.sendKeyEvent(37);driver.sendKeyEvent(40);driver.sendKeyEvent(56);driver.sendKeyEvent(31);driver.sendKeyEvent(43);driver.sendKeyEvent(41); // driver.findElement(By.id("com.mimedia.gallery:id/login_password")).click(); // driver.sendKeyEvent(41);driver.sendKeyEvent(29);driver.sendKeyEvent(42);driver.sendKeyEvent(38);driver.sendKeyEvent(49);driver.sendKeyEvent(38);driver.sendKeyEvent(36);driver.sendKeyEvent(29);driver.sendKeyEvent(77);driver.sendKeyEvent(8); driver.findElement(By.name("LOG IN")).click(); driver.findElement(By.name("COOL!")).click(); driver.findElement(By.name("OK!")).click(); }
// ####UI & Layout/Check all sreens/Camera/Upload status indicator/Test case NO: #### @Test public void C_sreens() { driver.findElement(By.name("Collections")).click(); driver.findElement(By.name("COOL!")).click(); driver.findElement(By.name("MiDrive")).click(); driver.findElement(By.name("COOL!")).click(); driver.findElement(By.name("Collections")).click(); // driver.findElement(By.name("Gallery")).click(); // driver.findElement(By.xpath("//*[@class='android.widget.TextView' and @index='1']")).click(); // List<WebElement> editBox=driver.findElements(By.className("android.widget.TextView")); // editBox.get(4).click(); }
/** * 到个人中心——发布的病例查看刚发布的病例 * * @return */ public static WebElement checkCase() { WebElement eMainMenu = driver.findElement(By.className(IndexPageElements.MAIN_MENU)); eMainMenu.click(); WebElement ePersonalCerter = driver.findElement(By.id(MainMenuPageElements.PERSONAL_CERTER)); ePersonalCerter.click(); WebElement eReleaseCase = driver.findElement(By.id(PerCenterPageElements.RELEASE_CASE)); eReleaseCase.click(); WebElement eReleaseCaseTitle = driver.findElement(By.id(PerCenterPageElements.RELEASE_CASE_TITLE)); return eReleaseCaseTitle; }
@Test public void G_sharing() { // driver.findElement(By.name("Gallery")).click(); // List<WebElement> editBox=driver.findElements(By.className("android.widget.TextView")); // editBox.get(3).click(); List<WebElement> collection1 = driver.findElements(By.className("android.view.View")); // Taping on Collection folder collection1.get(5).click(); driver.findElement(By.xpath("//*[@class='android.view.View' and @index='2']")).click(); // TouchAction tActionn=new TouchAction(driver); //Tap function // tActionn.tap(150,301).release().perform(); driver.findElementByAccessibilityId("Share").click(); driver.navigate().back(); driver.findElement(By.id("com.mimedia.gallery:id/gallery_action_bar_nav_icon")).click(); }
public void acceptAlert() { Log.logInfo("accept alerts"); if (waitForText(20, "记住我的选择", "禁止", "允许")) { Log.logInfo("点击[允许]"); driver.findElement(By.name("允许")).click(); } }
/** 验证搜索结果列表医师tag页 */ @Test(priority = 5) public void assertDoctor() { WebElement eDoctorBtn = driver.findElement(By.id(SearchPageElements.search_user)); eDoctorBtn.click(); List<String> doctorName = SearchPageElements.getDoctorName(); System.out.println("\n医师tab页搜索结果:"); for (int i = 0; i < doctorName.size() - 1; i++) { System.out.println(doctorName.get(i)); // Assertion.assertEquals(true, doctorName.get(i).contains(keyword), "搜索结果显示错误,请检查!"); } }
/** 验证搜索结果列表话题tag页 */ @Test(priority = 4) public void assertTopic() { WebElement eTopicBtn = driver.findElement(By.id(SearchPageElements.search_topic)); eTopicBtn.click(); List<String> topicInfo = SearchPageElements.getResourceName(); System.out.println("\n话题tab页搜索结果:"); for (int i = 0; i < topicInfo.size() - 1; i++) { System.out.println(topicInfo.get(i)); // Assertion.assertEquals(true, topicInfo.get(i).contains(keyword), "搜索结果显示错误,请检查!"); } }
/** 验证搜索结果列表病例tag页 */ @Test(priority = 2) public void assertCase() { WebElement eCaseBtn = driver.findElement(By.id(SearchPageElements.search_case)); eCaseBtn.click(); List<String> caseInfo = SearchPageElements.getResourceName(); System.out.println("\n病例tab页搜索结果:"); for (int i = 0; i < caseInfo.size() - 1; i++) { System.out.println(caseInfo.get(i)); // Assertion.assertEquals(true, caseInfo.get(i).contains(keyword), "搜索结果显示错误,请检查!"); } }
/** 验证搜索结果列表视频tag页 */ @Test(priority = 3) public void assertVideo() { WebElement eVideoBtn = driver.findElement(By.id(SearchPageElements.search_video)); eVideoBtn.click(); List<String> videoInfo = SearchPageElements.getResourceName(); System.out.println("\n视频tab页搜索结果:"); for (int i = 0; i < videoInfo.size() - 1; i++) { System.out.println(videoInfo.get(i)); // Assertion.assertEquals(true, videoInfo.get(i).contains(keyword), "搜索结果显示错误,请检查!"); } }
/** 验证搜索结果列表医师tag页 */ @Test(priority = 6) public void assertLabel() { WebElement eLabelBtn = driver.findElement(By.id(SearchPageElements.search_label)); eLabelBtn.click(); List<String> labelName = SearchPageElements.getLabelName(); System.out.println("\n标签tab页搜索结果:"); for (int i = 0; i < labelName.size() - 1; i++) { System.out.println(labelName.get(i)); Assertion.assertEquals(true, labelName.get(i).contains(keyword), "搜索结果显示错误,请检查!"); } }
@Test public void H_swipe() { driver.findElement(By.xpath("//*[@class='android.view.View' and @index='0']")).click(); JavascriptExecutor js = (JavascriptExecutor) driver; HashMap<String, Double> swipeObject = new HashMap<String, Double>(); swipeObject.put("startX", 2.00); swipeObject.put("startY", 272.00); swipeObject.put("endX", 670.00); swipeObject.put("endY", 272.00); swipeObject.put("duration", 2.0); js.executeScript("mobile: swipe", swipeObject); }
@Test public void addContact() { WebElement el = driver.findElement(By.name("Add Contact")); el.click(); // List<AndroidElement> textFieldsList = // driver.findElementsByClassName("android.widget.EditText"); List<WebElement> textFieldsList = driver.findElementsByClassName("android.widget.EditText"); textFieldsList.get(0).sendKeys("Some Name"); textFieldsList.get(2).sendKeys("*****@*****.**"); driver.swipe(100, 500, 100, 100, 2); driver.findElementByName("Save").click(); }
/** * 删除病例 * * @return */ public static boolean deleteCase() { WebElement eEditBtn = driver.findElement(By.id(edit_case_btn)); eEditBtn.click(); Utils.sleep(5); boolean flag = Utils.swipe(driver, By.id(delete_case_btn), 5); if (flag) { WebElement eDeleteCase = driver.findElement(By.id(delete_case_btn)); eDeleteCase.click(); } else { Assertion.assertEquals(true, flag, "删除按钮未找到,请检查后再试!"); } boolean deleteCaseContent = Utils.isElementExist(driver, By.id(delete_case_message)); int num = 0; while (deleteCaseContent == false && num < 10) { System.out.println(num); deleteCaseContent = Utils.isElementExist(driver, By.id(delete_case_message)); num++; } return deleteCaseContent; }
@Test public void D_camera() { // driver.findElement(By.name("Gallery")).click(); driver.findElementByAccessibilityId("Camera").click(); WebDriver augmentedDriver = new Augmenter().augment(driver); // Landscape orientation ((Rotatable) augmentedDriver).rotate(ScreenOrientation.LANDSCAPE); // Landscape orientation driver.findElement(By.id("com.android.camera2:id/second_shutter_button")).click(); driver.findElement(By.id("com.android.camera2:id/third_shutter_button")).click(); driver.findElement(By.id("com.android.camera2:id/third_shutter_button")).click(); WebDriver augmentedDriver1 = new Augmenter().augment(driver); // Landscape orientation ((Rotatable) augmentedDriver1).rotate(ScreenOrientation.PORTRAIT); { driver.findElement(By.id("com.android.camera2:id/second_shutter_button")).click(); } driver.findElement(By.id("com.android.camera2:id/third_shutter_button")).click(); driver.findElement(By.id("com.android.camera2:id/third_shutter_button")).click(); driver.navigate().back(); }
@Test public void launchingWatsapp() throws IOException, InterruptedException { stopAppiumServer(); startAppiumServer(); capabilities = new DesiredCapabilities(); capabilities.setCapability("automationName", "Appium"); capabilities.setCapability("platformName", "Android"); capabilities.setCapability("platformVersion", "4.4.4"); capabilities.setCapability("deviceName", "Samsung Galaxy S5 - 4.4.4 - API 19 - 1080x1920"); capabilities.setCapability("app", appPath); capabilities.setCapability("appPackage", "com.whatsapp"); capabilities.setCapability("appActivity", "com.whatsapp.Main"); System.out.println("Trying to start the driver"); driver = new AndroidDriver<WebElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); Thread.sleep(5000); if (driver.findElement(By.id("com.whatsapp:id/parentPanel")).isDisplayed()) { driver.findElement(By.id("android:id/button2")).click(); System.out.println("Successfully clicked on the \"OK\" button"); } // driver.findElement(By.partialLinkText("Agree and continue")).click(); driver .findElementByAndroidUIAutomator("new UiSelector().textMatches(\"Agree and continue\")") .click(); if (!(driver .findElement(By.id("com.whatsapp:id/registration_country")) .getText() .equalsIgnoreCase("United States"))) { driver.findElement(By.id("com.whatsapp:id/registration_country")).sendKeys("United States"); } driver.findElement(By.id("com.whatsapp:id/registration_phone")).sendKeys("1234567890"); driver.findElement(By.id("com.whatsapp:id/registration_submit")).click(); Thread.sleep(30000); try { if (driver.findElement(By.id("android.widget.LinearLayout")).isDisplayed()) { driver.findElement(By.id("android:id/button1")).click(); } } catch (Exception e) { } }
@Test public void E_collectionscreen() { driver.findElement(By.name("Collections")).click(); WebElement plus = driver.findElement(By.id("com.mimedia.gallery:id/merged_collection_list_create")); plus.click(); driver.findElement(By.name("New collection")).sendKeys("Simone"); driver.findElement(By.name("Create")).click(); driver.findElement(By.id("com.mimedia.gallery:id/gallery_action_bar_nav_icon")).click(); List<WebElement> editBox = driver.findElements(By.className("android.view.View")); // select collections folder editBox.get(6).click(); driver.findElement(By.id("com.mimedia.gallery:id/gallery_action_bar_nav_icon")).click(); }
public static void main(String[] args) throws MalformedURLException, InterruptedException { DesiredCapabilities DC = new DesiredCapabilities(); DC.setCapability(MobileCapabilityType.DEVICE_NAME, "android"); DC.setCapability(MobileCapabilityType.AUTOMATION_NAME, "appium"); DC.setCapability(MobileCapabilityType.PLATFORM_NAME, Platform.ANDROID); // DC.setCapability(MobileCapabilityType.PLATFORM_VERSION, "4.3"); DC.setCapability(MobileCapabilityType.BROWSER_NAME, "android"); DC.setCapability(MobileCapabilityType.HAS_TOUCHSCREEN, true); DC.setCapability( MobileCapabilityType.APP, "/Users/saurabhrai/Desktop/akosha-qa-universal-release.apk"); AndroidDriver appiumDriver = new AndroidDriver(new URL("http://localhost:4723/wd/hub"), DC); System.out.println("done"); Thread.sleep(3000); WebElement a = appiumDriver.findElement(By.id("com.akosha.directtalk:id/ed_phone_number")); int b = a.getText().length(); for (int i = 0; i < b; i++) { appiumDriver.sendKeyEvent(67); // "KEYCODE_DEL" // System.out.println(i); } a.sendKeys("9739559642"); System.out.println(b); // a.sendKeys("9739559642"); appiumDriver.findElement(By.name("Next")).click(); appiumDriver.findElement(By.name("CONFIRM")).click(); appiumDriver.findElement(By.id("com.akosha.directtalk:id/ed_otp")).sendKeys("1234"); appiumDriver.findElement(By.name("Done")).click(); WebDriverWait wait = new WebDriverWait(appiumDriver, 30); wait.until( ExpectedConditions.presenceOfElementLocated( By.id("com.akosha.directtalk:id/view_profile"))); // List<MobileElement> d = // appiumDriver.findElements(By.id("com.akosha.directtalk:id/landing_grid_item_text")); // WebDriverWait wait1=new WebDriverWait(appiumDriver, 70); // // wait1.until(ExpectedConditions.presenceOfElementLocated(By.id("com.akosha.directtalk:id/progressBar1"))); // String app = // appiumDriver.findElement(By.id("com.akosha.directtalk:id/place_name")).getText(); // String app = appiumDriver.findElement(By.name("BCD Travels")).getText(); // System.out.println(app); /** try with text name */ // // MobileElement element = (MobileElement) appiumDriver.findElement(By.name("BCD Travels")); // System.out.println(element.getText()); // for (int i = 0; i < 4; i++) { // element.swipe(SwipeElementDirection.DOWN, 4); // } MobileElement element = (MobileElement) appiumDriver.findElement(By.className("android.support.v7.widget.RecyclerView")); for (int i = 0; i < 3; i++) { element.swipe(SwipeElementDirection.DOWN, 0, 370, 0); } /** working for search nearby */ // appiumDriver.findElement(By.name("Food, ATM, fuel and much more...")).click(); // System.out.println(1); // Thread.sleep(7000); // MobileElement element = (MobileElement) // appiumDriver.findElement(By.className("android.widget.LinearLayout")); // // for (int i = 0; i < 3; i++) { // element.swipe(SwipeElementDirection.DOWN, 0, 669 , 0); // // } // // // ((MobileElement) element).swipe(SwipeElementDirection.UP, 20, -50, 30); /** old trial */ //// MobileElement element = (MobileElement) // e.swipe(SwipeElementDirection.UP, 0, -50, 10); //// // // e.swipe(direction, offsetFromStartBorder, offsetFromEndBorder, duration); // }
/** * 发布病例,并根据终端页信息验证是否发布成功。 * * @param case_title * @param age * @param main_suit * @param case_talk * @return */ public static String pubCase(String case_title, String age, String main_suit, String case_talk) { WebElement ePubCaseBtn = driver.findElement(By.id(pub_case_btn)); ePubCaseBtn.click(); WebElement eSelectMajor = driver.findElement(By.id(select_major)); eSelectMajor.click(); WebElement eSelectMajorNext = driver.findElement(By.id(select_major_next)); eSelectMajorNext.click(); WebElement eCaseTitle = driver.findElement(By.id(case_title_input)); eCaseTitle.sendKeys(case_title); WebElement eSelectWomen = driver.findElement(By.id(selcect_women)); eSelectWomen.click(); WebElement eAgeYear = driver.findElement(By.id(age_year_input)); eAgeYear.sendKeys(age); WebElement eMainSuit = driver.findElement(By.id(main_suit_input)); eMainSuit.clear(); eMainSuit.sendKeys(main_suit); WebElement eCaseTalk = driver.findElement(By.id(case_talk_input)); eCaseTalk.clear(); eCaseTalk.sendKeys(case_talk); WebElement eLoadPic = driver.findElement(By.id(preoperative_pic)); eLoadPic.click(); WebElement eSelectPic1 = driver.findElement(By.xpath(SELECT_PIC1)); eSelectPic1.click(); WebElement eSelectPic2 = driver.findElement(By.xpath(SELECT_PIC2)); eSelectPic2.click(); WebElement eSelectPicNext = driver.findElement(By.id(SELECT_PIC_NEXT)); eSelectPicNext.click(); eSelectPicNext.click(); boolean flag = Utils.swipe(driver, By.id(pub_case), 2); boolean ePubCaseAttribute; if (flag) { ePubCaseAttribute = Boolean.parseBoolean(driver.findElement(By.id(pub_case)).getAttribute("clickable")); if (ePubCaseAttribute) { WebElement ePubCase = driver.findElement(By.id(pub_case)); ePubCase.click(); } else { Assertion.assertEquals(true, ePubCaseAttribute, "未触发发布按钮,是置灰状态!"); } } else { Assertion.assertEquals(true, flag, "发布按钮未找到,请检查后再试!"); } String terminalCaseName = ""; boolean findCaseTitle = Utils.isElementExist(driver, By.id(terminal_case_name)); int num = 0; if (findCaseTitle == false) { while (findCaseTitle == false && num < 10) { findCaseTitle = Utils.isElementExist(driver, By.id(terminal_case_name)); System.out.println(num); if (findCaseTitle) { terminalCaseName = Utils.getText(driver, By.id(terminal_case_name)); } else { num++; } } } else { terminalCaseName = Utils.getText(driver, By.id(terminal_case_name)); } return terminalCaseName; }
@Test public void testBeHealthier() throws InterruptedException { // Chose Be Healthier Program driver.findElement(By.name("Be Healthier")).click(); // Select Age Button driver.findElement(By.id("button_age")).click(); // Swipe Across Months driver.swipe(192, 681, 192, 879, 1000); // Swipe Across Days driver.swipe(432, 681, 432, 1015, 2000); // Swipe Across years driver.swipe(672, 681, 672, 1450, 3000); // Click OK after selecting date of birth driver.findElement(By.id("button1")).click(); // Select Age Button to get entered birthday String dateOfBirth = driver.findElement(By.id("button_age")).getText(); // Select Male as a sex driver.findElement(By.id("radio_male")).click(); // Click continue to next Screen driver.findElement(By.id("button_continue")).click(); // Enter height driver.findElement(By.id("edittext_kg")).sendKeys("172"); // Click continue to next Screen driver.findElement(By.id("button_continue")).click(); // Enter weight driver.findElement(By.id("edittext_kg")).sendKeys("72"); // Click continue to next Screen driver.findElement(By.id("button_continue")).click(); // Wait until personalizing the app Thread.sleep(20000); // Skip first meal driver.findElement(By.id("skip_button")).click(); // Wait until getting plan page Thread.sleep(5000); // Get target calories per day to assert latter String targetCaloriesPerDay = driver.findElement(By.id("textview_diary_left_value1")).getText(); // Press the menu button driver .findElement(By.id("toolbar")) .findElement(By.className("android.widget.ImageButton")) .click(); ; Thread.sleep(1000); // Press Settings driver.findElement(By.name("Settings")).click(); Thread.sleep(1000); // Press Personal Details driver.findElement(By.name("Personal Details")).click(); Thread.sleep(1000); // Assert stored values against entered values collector.checkThat( "Assert Main Screen Target Calories Per Day", targetCaloriesPerDay, CoreMatchers.equalTo("2250")); collector.checkThat( "Assert Curren tWeight ", driver.findElements(By.id("textview_second")).get(0).getText(), CoreMatchers.equalTo("72 kg")); collector.checkThat( "Assert Calories Per Day ", "2250 kcal", CoreMatchers.equalTo(driver.findElements(By.id("textview_second")).get(1).getText())); collector.checkThat( "Assert Height ", driver.findElements(By.id("textview_second")).get(2).getText(), CoreMatchers.equalTo("172 cm")); collector.checkThat( "Assert Date Of Birth ", driver.findElements(By.id("textview_second")).get(3).getText(), CoreMatchers.equalTo(dateOfBirth)); collector.checkThat( "Assert Gender ", driver.findElements(By.id("textview_second")).get(4).getText(), CoreMatchers.equalTo("Male")); // Press the back button to log out driver .findElement(By.id("action_bar")) .findElement(By.className("android.widget.ImageButton")) .click(); driver.scrollTo("Log out").click(); driver.findElement(By.id("button1")).click(); // Wait 10 seconds before starting next test case Thread.sleep(10000); driver.quit(); }
@Test public void B_navigation() { driver.findElement(By.id("com.mimedia.gallery:id/gallery_action_bar_nav_icon")).click(); driver.findElement(By.name("Photos")).click(); driver.findElement(By.id("com.mimedia.gallery:id/gallery_action_bar_nav_icon")).click(); driver.findElement(By.name("Videos")).click(); driver.findElement(By.id("com.mimedia.gallery:id/gallery_action_bar_nav_icon")).click(); driver.findElement(By.name("Gallery")).click(); driver.findElement(By.id("com.mimedia.gallery:id/gallery_action_bar_nav_icon")).click(); driver.findElement(By.name("Favorites")).click(); driver.findElement(By.id("com.mimedia.gallery:id/gallery_action_bar_nav_icon")).click(); driver.findElement(By.name("Settings")).click(); driver.findElement(By.id("com.mimedia.gallery:id/gallery_action_bar_nav_icon")).click(); driver.findElement(By.name("Gallery")).click(); }