List of usage examples for org.openqa.selenium By tagName
public static By tagName(String tagName)
From source file:com.autocognite.appium.lib.base.AbstractAppiumUiDriver.java
License:Apache License
public By getFinderType(String identifier, String idValue) throws Exception { By findBy = null;//from www. jav a 2 s . com MobileWebIdentifyBy idType = null; try { idType = MobileWebIdentifyBy.valueOf(identifier.toUpperCase()); } catch (Throwable e) { throwUnsupportedIndentifierException(this.getName(), "getFinderType", identifier); } switch (identifier.toUpperCase()) { case "ID": findBy = By.id(idValue); break; case "NAME": findBy = By.name(idValue); break; case "CLASS": findBy = By.className(idValue); break; case "LINK_TEXT": findBy = By.linkText(idValue); break; case "PARTIAL_LINK_TEXT": findBy = By.partialLinkText(idValue); break; case "XPATH": findBy = By.xpath(idValue); break; case "CSS": findBy = By.cssSelector(idValue); break; case "TAG": findBy = By.tagName(idValue); break; } return findBy; }
From source file:com.autocognite.appium.lib.base.AbstractAppiumUiDriver.java
License:Apache License
public void waitForBody() throws Exception { waitForElementPresence(By.tagName("body")); }
From source file:com.autocognite.selenium.lib.SeleniumWebUiDriver.java
License:Apache License
@SuppressWarnings("incomplete-switch") public By getFinderType(String identifier, String idValue) throws Exception { By findBy = null;// www. j a va2 s . c o m WebIdentifyBy idType = null; try { idType = WebIdentifyBy.valueOf(identifier.toUpperCase()); } catch (Throwable e) { throwUnsupportedIndentifierException(Configurator.getComponentName("WEBDRIVER_AUTOMATOR"), "getFinderType", identifier); } switch (idType) { case ID: findBy = By.id(idValue); break; case NAME: findBy = By.name(idValue); break; case CLASS: findBy = By.className(idValue); break; case LINK_TEXT: findBy = By.linkText(idValue); break; case PARTIAL_LINK_TEXT: findBy = By.partialLinkText(idValue); break; case XPATH: findBy = By.xpath(idValue); break; case CSS: findBy = By.cssSelector(idValue); break; case TAG: findBy = By.tagName(idValue); break; } return findBy; }
From source file:com.axatrikx.webdriver.ElementHelper.java
License:Apache License
private By parseLocator(String locator) { String locValue;/*from w w w . j av a2 s . c o m*/ By byElement = null; if (locator.toLowerCase().startsWith("id=")) { locValue = locator.substring(3); byElement = By.id(locValue); } else if (locator.toLowerCase().startsWith("name=")) { locValue = locator.substring(5); byElement = By.name(locValue); } else if (locator.toLowerCase().startsWith("class=")) { locValue = locator.substring(6); byElement = By.className(locValue); } else if (locator.toLowerCase().startsWith("css=")) { locValue = locator.substring(4); byElement = By.cssSelector(locValue); } else if (locator.toLowerCase().startsWith("xpath=")) { locValue = locator.substring(6); byElement = By.xpath(locValue); } else if (locator.toLowerCase().startsWith("classname=")) { locValue = locator.substring(10); byElement = By.className(locValue); } else if (locator.toLowerCase().startsWith("tagname=")) { locValue = locator.substring(8); byElement = By.tagName(locValue); } else if (locator.toLowerCase().startsWith("link=")) { locValue = locator.substring(5); byElement = By.linkText(locValue); } else if (locator.toLowerCase().startsWith("partiallinktext=")) { locValue = locator.substring(16); byElement = By.partialLinkText(locValue); } else { // set default to id byElement = By.id(locator); } return byElement; }
From source file:com.bc.opec.webtests.WebTestBase.java
License:Open Source License
public void closePopups() { Assert.assertTrue(driver.getTitle().startsWith("OPEC")); for (WebElement e : driver.findElements(By.tagName("Button"))) { if (e.getAttribute("title").equals("Close")) { e.click();/*from w w w . j a v a2 s . c o m*/ break; } } for (WebElement e : driver.findElements(By.tagName("Button"))) { if (e.getText().equals("No")) { e.click(); break; } } driver.findElement( By.xpath("//*/div[@aria-describedby='gisportal-layerSelection']/div/div/button[@title='close']")) .click(); }
From source file:com.chtr.tmoauto.webui.CommonFunctions.java
License:Open Source License
@Override public String getBodyText() { return webDriver.findElement(By.tagName("body")).getText(); }
From source file:com.chtr.tmoauto.webui.CommonFunctions.java
License:Open Source License
/** * FLAGGED FOR DELETION// ww w . ja v a 2s .c o m */ @Override public String getTable(String locator) { log.debug("Getting table ..."); String[] tableLocation = locator.split("\\.", 3); if (tableLocation.length != 3) { throw new RuntimeException("Incorrect table locator used"); } WebElement table = findElement(tableLocation[0]); List<WebElement> allRows = table.findElements(By.tagName("tr")); List<WebElement> cells = allRows.get(Integer.parseInt(tableLocation[1])).findElements(By.tagName("td")); return cells.get(Integer.parseInt(tableLocation[2])).getText(); }
From source file:com.chtr.tmoauto.webui.CommonFunctions.java
License:Open Source License
@Override public String getMainFrame() { String nameOrId = null;/*from ww w . jav a 2 s . c o m*/ final List<WebElement> iframes = webDriver.findElements(By.tagName("iframe")); if (iframes.size() != 0) { nameOrId = iframes.get(0).getAttribute("id"); if (nameOrId == null) { nameOrId = iframes.get(0).getAttribute("name"); return nameOrId; } return nameOrId; } return null; }
From source file:com.citrix.g2w.webdriver.pages.registration.RegistrationConfirmationPage.java
License:Open Source License
/** * Method to return Calendar Link ./*from w ww. ja va 2 s . c om*/ * * @return calendarUrl */ public String getCalendarUrl() { return this.attendeeCalendarUrl.findElement(By.tagName("a")).getAttribute("href"); }
From source file:com.coderoad.automation.common.util.old.BasePage.java
License:Open Source License
public void verifyPageDisplaysVersion(Modules module) { LogUtil.log("Switch to iframe.", LogLevel.LOW); WaitUtil.waitUntil(Timeout.FIVE_SEC); getDriver().switchTo().frame(driver.findElement(By.tagName("iframe"))); LogUtil.log("Get version.", LogLevel.LOW); String version = this.getVersion(module); Assert.assertTrue("The page do not show the version.", version != null); LogUtil.log("The version is:" + version, LogLevel.LOW); }