List of usage examples for org.openqa.selenium WebDriver getTitle
String getTitle();
From source file:org.mitre.mpf.wfm.ui.HomePage.java
License:Open Source License
public HomePage(WebDriver driver) { if (!ValidPage(driver)) { throw new IllegalStateException("This is not Home Page of logged in user, current page is: " + driver.getCurrentUrl() + " Title:" + driver.getTitle()); }// w w w. j a va2 s . c o m }
From source file:org.mitre.mpf.wfm.ui.HomePage.java
License:Open Source License
public static boolean ValidPage(WebDriver driver) { log.info("Current Title:" + driver.getTitle() + " Desired:" + PAGE_TITLE); return driver.getTitle().startsWith(PAGE_TITLE); }
From source file:org.mitre.mpf.wfm.ui.HomePage.java
License:Open Source License
/** * Login as valid user// ww w . j av a 2s . co m * * @param userName * @param password * @return HomePage object */ public LoginPage logout(WebDriver driver) { if (!ValidPage(driver)) { throw new IllegalStateException( "This is not Home Page of logged in user, current page" + "is: " + driver.getCurrentUrl()); } try { //clear all popups if possible when trying to logout //while noty popups exist while (driver.findElement(By.className("noty_text")) != null) { //click the "Close All" button Utils.safeClickById(driver, "button-1"); //sleep for a second to wait for noty to display others from the // queue since "Close All" now only closes what is visible try { Thread.sleep(1000); } catch (InterruptedException e) { log.error("Error while sleeping for 1000ms after closing noty notifications"); } } } catch (NoSuchElementException e) { //will be thrown when driver.findElement(By.className("noty_text")) can't find the element log.info("No noty notifications present during logout."); } //Hopefully it is impossible for a noty notification to pop up between these operations // click the dropdown Utils.safeClickByCss(driver, "a.dropdown-toggle"); // click the logout link Utils.safeClickByLinkText(driver, "Logout"); // Wait for the login page to load, timeout after 10 seconds (new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() { public Boolean apply(WebDriver d) { return d.getTitle().startsWith(LoginPage.PAGE_TITLE); } }); return new LoginPage(driver); }
From source file:org.mitre.mpf.wfm.ui.JobStatusPage.java
License:Open Source License
public static boolean ValidPage(WebDriver driver) { log.debug("Current Title:" + driver.getTitle() + " Desired:" + PAGE_TITLE + " " + driver.getCurrentUrl() + " " + Utils.checkIDExists(driver, "jobTable")); return driver.getTitle().startsWith(PAGE_TITLE) && driver.getCurrentUrl().contains(PAGE_URL) && Utils.checkIDExists(driver, "jobTable"); }
From source file:org.mitre.mpf.wfm.ui.LoginPage.java
License:Open Source License
public LoginPage(WebDriver driver) { if (!ValidPage(driver)) { throw new IllegalStateException("This is not sign in page, current page is: " + driver.getCurrentUrl() + " Title:" + driver.getTitle()); }/* w w w. j a v a 2s. com*/ }
From source file:org.mitre.mpf.wfm.ui.LoginPage.java
License:Open Source License
public static boolean ValidPage(WebDriver driver) { log.info("Current Title:" + driver.getTitle() + " Desired:" + PAGE_TITLE); return driver.getTitle().equals(PAGE_TITLE); }
From source file:org.mitre.mpf.wfm.ui.LoginPage.java
License:Open Source License
/** * Login as valid user//from w ww . ja v a 2s .c o m * * @param userName * @param password * @return HomePage object */ public HomePage loginValidUser(WebDriver driver, String username, String password) { WebElement element = driver.findElement(By.name("username")); element.sendKeys(username); element = driver.findElement(By.name("password")); element.sendKeys(password); // Now submit the form. element.submit(); // Wait for the page to load, timeout after 10 seconds (new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() { public Boolean apply(WebDriver d) { return d.getTitle().startsWith(HomePage.PAGE_TITLE); } }); return new HomePage(driver); }
From source file:org.mitre.mpf.wfm.ui.LogsPage.java
License:Open Source License
public static boolean ValidPage(WebDriver driver) { log.debug("Current Title:" + driver.getTitle() + " Desired:" + PAGE_TITLE); return driver.getTitle().startsWith(PAGE_TITLE) && driver.getCurrentUrl().contains(PAGE_URL) && Utils.checkIDExists(driver, "logButtonsRow"); }
From source file:org.mitre.mpf.wfm.ui.NodeConfigurationPage.java
License:Open Source License
public static boolean ValidPage(WebDriver driver) { log.debug("Current Title:" + driver.getTitle() + " Desired:" + PAGE_TITLE); return driver.getTitle().startsWith(PAGE_TITLE) && driver.getCurrentUrl().contains(PAGE_URL) && Utils.checkIDExists(driver, "catalog-area"); }
From source file:org.mitre.mpf.wfm.ui.NodesAndProcessPage.java
License:Open Source License
public static boolean ValidPage(WebDriver driver) { boolean exists = Utils.checkIDExists(driver, "nodes-and-processes-table"); log.info("Current Title: {} Desired:{} Current Url: {}, table exists: {}", driver.getTitle(), PAGE_TITLE, driver.getCurrentUrl(), exists); return driver.getCurrentUrl().contains(PAGE_URL) && exists; }