// PAGE OBJECT METHODS public void waitTillFeaturedPageIsDisplayed() throws Exception { Reporter.log( "Invoke Application: " + System.getProperty("AppName") + " to display Featured Page.."); SeleniumFunctions.isElementPresent(driver, By.id(loginButton), 60); SeleniumFunctions.isElementPresent(driver, By.id(Search_Btn), 30); }
public void logoutUser(boolean reportStep) throws Exception { if (reportStep) { Reporter.log("Log out User."); } if (SeleniumFunctions.isElementPresent(driver, By.id(tvProviderLogo), 10)) { SeleniumFunctions.click(driver, By.id(tvProviderLogo)); SeleniumFunctions.click(driver, By.id(yesButton)); SeleniumFunctions.waitTillElementIsDisplayed(driver, By.name("Log out successfull"), 15); } }
public void navigateToFeaturedPage() { int i = 0; boolean flag = false; while (flag == false) { try { flag = SeleniumFunctions.isElementPresent(driver, By.id(featuredPage), 15); if (flag) { SeleniumFunctions.click(driver, By.id(featuredPage)); break; } else { i = i + 1; driver.navigate().back(); } if (i > 5) { Assert.fail("Unable to navigate to Featured Page"); break; } } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
public void selectRestrictedVideo() throws Exception { Reporter.log("Select a Restricted Video from Featured Page."); List<WebElement> webColl = null; while (webColl == null) { webColl = driver.findElements(By.id(restrictedVideo)); if (webColl.size() > 0) { webColl.get(0).click(); break; } else { webColl = null; } SeleniumFunctions.scrollToObject(driver); } }
public String getVersionNumber() throws Exception { boolean flag; String versionNumber = ""; SeleniumFunctions.isElementPresent(driver, By.id(moreButton), 60); SeleniumFunctions.click(driver, By.id(moreButton)); try { flag = SeleniumFunctions.isElementPresent(driver, By.name("More"), 30); if (flag) { SeleniumFunctions.click(driver, By.name("More")); versionNumber = SeleniumFunctions.getText(driver, By.id(versionNumberLabel)); if (SeleniumFunctions.getText(driver, By.id(wifiButton)).toLowerCase().contains("on")) { SeleniumFunctions.click(driver, By.id(wifiButton)); } driver.navigate().back(); Thread.sleep(1000); } } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } return versionNumber; }
public void clickOnLoginButton() throws Exception { Reporter.log("Click on Login Button on Featured Page."); SeleniumFunctions.click(driver, By.id(loginButton)); }