List of usage examples for org.openqa.selenium By tagName
public static By tagName(String tagName)
From source file:com.ibm.sbt.automation.core.environment.TestEnvironment.java
License:Open Source License
/** * Wait the specified interval for the specified web element to be available *///from w w w .ja v a 2 s .c o m public WebElement waitForElement(final String match, final int secs, final String condition) { try { return (new WebDriverWait(getPageObject().getWebDriver(), secs)) .until(new ExpectedCondition<WebElement>() { @Override public WebElement apply(WebDriver webDriver) { failIfPageCrashed(webDriver); webDriver = getPageObject(webDriver).getWebDriver(); if (condition.equalsIgnoreCase("id")) { return webDriver.findElement(By.id(match)); } else if (condition.equalsIgnoreCase("linkText")) { return webDriver.findElement(By.linkText(match)); } else if (condition.equalsIgnoreCase("tagName")) { return webDriver.findElement(By.tagName(match)); } else if (condition.equalsIgnoreCase("name")) { return webDriver.findElement(By.name(match)); } else if (condition.equalsIgnoreCase("idWithText")) { WebElement element = webDriver.findElement(By.id(match)); String text = element.getText(); if (StringUtil.isNotEmpty(text)) { return element; } String value = element.getAttribute("value"); if (StringUtil.isNotEmpty(value)) { return element; } return null; } else if (condition.equalsIgnoreCase("idWithChild")) { WebElement element = webDriver.findElement(By.id(match)); List<WebElement> children = element.findElements(By.xpath("*")); if (!children.isEmpty()) { return element; } return null; } else { return webDriver.findElement(By.name(match)); } } }); } catch (Exception e) { return null; } }
From source file:com.ibm.sbt.automation.core.environment.TestEnvironment.java
License:Open Source License
/** * Wait the specified interval for the specified web element to be available * with the specified children// w w w . jav a 2s . c o m */ public WebElement waitForChildren(final String tagName, final String xpath, final int secs) { try { return (new WebDriverWait(getPageObject().getWebDriver(), secs)) .until(new ExpectedCondition<WebElement>() { @Override public WebElement apply(WebDriver webDriver) { failIfPageCrashed(getPageObject(webDriver).getWebDriver()); WebElement tableElement = getPageObject(webDriver).getWebDriver() .findElement(By.tagName(tagName)); WebElement element = tableElement.findElement(By.xpath(xpath)); return element; } }); } catch (Exception e) { return null; } }
From source file:com.ibm.sbt.automation.core.test.pageobjects.AcmeSample.AcmeMyFlightPage.java
License:Open Source License
public List<WebElement> getMyFlights() { List<WebElement> flights = myFlightsTable.findElements(By.tagName("tr")); return flights; }
From source file:com.ibm.sbt.automation.core.test.pageobjects.GridResultPage.java
License:Open Source License
/** * Return the table WebElement for the Grid that was created on this page * /* www.j a v a 2 s . c o m*/ * @return {WebElement} */ public WebElement getTable() { WebElement resultEl = getWebElement(); return resultEl.findElement(By.tagName("table")); }
From source file:com.ibm.sbt.automation.core.test.pageobjects.GridResultPage.java
License:Open Source License
/** * Return the tbody WebElement for the Grid that was created on this page * //from ww w. j a v a 2 s. c o m * @return {WebElement} */ public WebElement getTableBody() { WebElement resultEl = getWebElement(); return resultEl.findElement(By.tagName("tbody")); }
From source file:com.ibm.sbt.automation.core.test.pageobjects.GridResultPage.java
License:Open Source License
/** * Return a list of tr WebElement for the Grid that was created on this page * /*from w w w . j a va 2s.c o m*/ * @return {List<WebElement>} */ public List<WebElement> getTableRows() { WebElement resultEl = getWebElement(); return resultEl.findElements(By.tagName("tr")); }
From source file:com.ibm.sbt.automation.core.test.pageobjects.ListResultPage.java
License:Open Source License
/** * Return the ul WebElement for the Grid that was created on this page * // w w w .j av a 2 s. c o m * @return {WebElement} */ public WebElement getList() { WebElement resultEl = getWebElement(); return resultEl.findElement(By.tagName("ul")); }
From source file:com.ibm.sbt.automation.core.test.pageobjects.ListResultPage.java
License:Open Source License
/** * Return a list of li WebElement for the Grid that was created on this page * /*from w w w . ja v a2 s .c o m*/ * @return {List<WebElement>} */ public List<WebElement> getListItems() { WebElement resultEl = getWebElement(); return resultEl.findElements(By.tagName("li")); }
From source file:com.ibm.sbt.automation.core.test.pageobjects.PanelResultPage.java
License:Open Source License
/** * Return the ul WebElement for the Grid that was created on this page * //from w ww .j a v a 2 s.c o m * @return {WebElement} */ public WebElement getPanel() { WebElement resultEl = getWebElement(); return resultEl.findElement(By.tagName("ul")); }
From source file:com.ibm.sbt.automation.core.test.pageobjects.PanelResultPage.java
License:Open Source License
public String getPhotoUrl() { WebElement resultEl = getWebElement(); WebElement img = resultEl.findElement(By.tagName("img")); return (img == null) ? null : img.getAttribute("src"); }