List of usage examples for org.openqa.selenium WebDriver getCurrentUrl
String getCurrentUrl();
From source file:org.mitre.mpf.wfm.ui.JobStatusPage.java
License:Open Source License
public static String[] getjobTableRow(WebDriver driver, int idx) { log.debug("[JobStatusPage] getjobTable"); if (!JobStatusPage.ValidPage(driver)) { throw new IllegalStateException("This is not the correct page, current page" + "is: " + driver.getCurrentUrl() + " should be " + JobStatusPage.PAGE_URL); }/*ww w. j ava 2s . co m*/ List<WebElement> rows = driver.findElements(By.xpath("//*[@id='jobTable']/tbody/tr")); if (rows.size() == 0) { log.error("[JobStatusPage] No jobs in the jobsTable"); return null; } WebElement job = rows.get(idx);//first element should be most recent job log.debug("[JobStatusPage] getjobTable job row [{}] : " + job.getText(), idx); //Id PipelineName StartDate EndDate Status Progress DetailedProgress List<WebElement> columns = job.findElements(By.tagName("td")); String[] ret = { columns.get(0).getText(), columns.get(1).getText(), columns.get(2).getText(), columns.get(3).getText(), columns.get(4).getText(), columns.get(5).getText(), columns.get(6).getText() }; return ret; }
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 ww.j a v a2 s . c om*/ }
From source file:org.mitre.mpf.wfm.ui.LogsPage.java
License:Open Source License
public LogsPage(WebDriver driver) { if (!ValidPage(driver)) { throw new IllegalStateException( "This is not correct page of logged in user, current page is: " + driver.getCurrentUrl()); }//from w ww . j a v a2 s . c om }
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.LogsPage.java
License:Open Source License
public static LogsPage getLogsPage(WebDriver driver) { //must be on homepage if (!HomePage.ValidPage(driver)) { throw new IllegalStateException( "This is not correct Home page, current page" + "is: " + driver.getCurrentUrl()); }/*www . ja v a 2 s .c o m*/ // click the nav link Utils.safeClickById(driver, LogsPage.NAV_ID); // 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 LogsPage.ValidPage(d); } }); return new LogsPage(driver); }
From source file:org.mitre.mpf.wfm.ui.NodeConfigurationPage.java
License:Open Source License
public NodeConfigurationPage(WebDriver driver) { if (!ValidPage(driver)) { throw new IllegalStateException( "This is not Home Page of logged in user, current page is: " + driver.getCurrentUrl()); }//from w w w . ja va 2s . c om }
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.NodeConfigurationPage.java
License:Open Source License
public static NodeConfigurationPage getNodeConfigurationPage(WebDriver driver) { // must be on homepage if (!HomePage.ValidPage(driver)) { throw new IllegalStateException( "This is not Home Page of logged in user, current page is: " + driver.getCurrentUrl()); }//from ww w.j a v a 2s .c o m // click the nav link Utils.safeClickById(driver, NodeConfigurationPage.NAV_ID); // 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 NodeConfigurationPage.ValidPage(d); } }); return new NodeConfigurationPage(driver); }
From source file:org.mitre.mpf.wfm.ui.NodeConfigurationPage.java
License:Open Source License
public int getCurrentServicesCount(WebDriver driver) { if (!HomePage.ValidPage(driver)) { throw new IllegalStateException( "This is not Home Page of logged in user, current page is: " + driver.getCurrentUrl()); }// w ww.j av a 2 s . c o m //get list of services String classname = "service-item-cart";//span log.info("Finding list of elements with class=" + classname); List<WebElement> carts = driver.findElements(By.className(classname));//grab the carts log.info("#carts:" + carts.size()); if (carts.size() == 0) return -1; WebElement cart = carts.get(0); List<WebElement> serviceItems = cart.findElements(By.className("dnd-item-count-input")); log.info("#service-items:" + serviceItems.size()); int count = 0; for (WebElement row : serviceItems) { String ele = row.getAttribute("value"); //log.info(ele); count += Integer.parseInt(ele); } return count; }
From source file:org.mitre.mpf.wfm.ui.NodesAndProcessPage.java
License:Open Source License
public NodesAndProcessPage(WebDriver driver) { if (!ValidPage(driver)) { throw new IllegalStateException( "This is not Home Page of logged in user, current page is: " + driver.getCurrentUrl()); }//from w w w. ja v a 2 s. c o m }