List of usage examples for org.openqa.selenium By tagName
public static By tagName(String tagName)
From source file:com.epam.jdi.uitests.mobile.appium.elements.complex.MultiSelector.java
License:Open Source License
protected void clearAction() { if (!hasLocator() && allLabels() == null) throw exception("Can't clear options. No optionsNamesLocator and allLabelsLocator found"); if (getLocator().toString().contains("%s")) throw exception( "Can't clear options. Specify allLabelsLocator or fix optionsNamesLocator (should not contain '%s')"); if (allLabels() != null) { clearElements(allLabels().avatar.searchAll().getElements()); return;//from w ww . ja v a 2s .c o m } List<WebElement> elements = getAvatar().searchAll().getElements(); WebElement element = elements.get(0); if (elements.size() == 1 && element.getTagName().equals("select")) if (getSelector().getOptions().size() > 0) { getSelector().deselectAll(); return; } else throw exception("<select> tag has no <option> tags. Please Clarify element locator (%s)", this); if (elements.size() == 1 && element.getTagName().equals("ul")) elements = element.findElements(By.tagName("li")); clearElements(elements); }
From source file:com.epam.jdi.uitests.mobile.appium.elements.pageobjects.annotations.AppiumAnnotationsUtil.java
License:Open Source License
public static By getFrame(Frame frame) { if (frame == null) return null; if (!"".equals(frame.id())) return By.id(frame.id()); if (!"".equals(frame.className())) return By.className(frame.className()); if (!"".equals(frame.xpath())) return By.xpath(frame.xpath()); if (!"".equals(frame.css())) return By.cssSelector(frame.css()); if (!"".equals(frame.linkText())) return By.linkText(frame.linkText()); if (!"".equals(frame.name())) return By.name(frame.name()); if (!"".equals(frame.partialLinkText())) return By.partialLinkText(frame.partialLinkText()); if (!"".equals(frame.tagName())) return By.tagName(frame.tagName()); return null;//from w ww .ja v a 2 s . c o m }
From source file:com.epam.jdi.uitests.mobile.appium.elements.pageobjects.annotations.AppiumAnnotationsUtil.java
License:Open Source License
public static By findByToBy(FindBy locator) { if (locator == null) return null; if (!"".equals(locator.id())) return By.id(locator.id()); if (!"".equals(locator.className())) return By.className(locator.className()); if (!"".equals(locator.xpath())) return By.xpath(locator.xpath()); if (!"".equals(locator.css())) return By.cssSelector(locator.css()); if (!"".equals(locator.linkText())) return By.linkText(locator.linkText()); if (!"".equals(locator.name())) return By.name(locator.name()); if (!"".equals(locator.partialLinkText())) return By.partialLinkText(locator.partialLinkText()); if (!"".equals(locator.tagName())) return By.tagName(locator.tagName()); return null;/* w ww . j av a 2 s . c o m*/ }
From source file:com.epam.jdi.uitests.mobile.appium.elements.pageobjects.annotations.AppiumAnnotationsUtil.java
License:Open Source License
public static By getFindByLocator(JFindBy locator) { if (locator == null) return null; if (!"".equals(locator.id())) return By.id(locator.id()); if (!"".equals(locator.className())) return By.className(locator.className()); if (!"".equals(locator.xpath())) return By.xpath(locator.xpath()); if (!"".equals(locator.css())) return By.cssSelector(locator.css()); if (!"".equals(locator.linkText())) return By.linkText(locator.linkText()); if (!"".equals(locator.name())) return By.name(locator.name()); if (!"".equals(locator.partialLinkText())) return By.partialLinkText(locator.partialLinkText()); if (!"".equals(locator.tagName())) return By.tagName(locator.tagName()); return null;/* ww w .ja v a2 s.co m*/ }
From source file:com.epam.jdi.uitests.mobile.appium.elements.pageobjects.annotations.WebAnnotationsUtil.java
License:Open Source License
public static By findByToBy(JFindBy locator) { if (locator == null) return null; if (!"".equals(locator.id())) return By.id(locator.id()); if (!"".equals(locator.className())) return By.className(locator.className()); if (!"".equals(locator.xpath())) return By.xpath(locator.xpath()); if (!"".equals(locator.css())) return By.cssSelector(locator.css()); if (!"".equals(locator.linkText())) return By.linkText(locator.linkText()); if (!"".equals(locator.name())) return By.name(locator.name()); if (!"".equals(locator.partialLinkText())) return By.partialLinkText(locator.partialLinkText()); if (!"".equals(locator.tagName())) return By.tagName(locator.tagName()); return null;/* w w w . j a va 2s . c om*/ }
From source file:com.epam.jdi.uitests.web.selenium.elements.complex.BaseSelector.java
License:Open Source License
protected Clickable getElement(String name) { if (!hasLocator() && allLabels() == null) throw exception("Can't find option '%s'. No optionsNamesLocator and allLabelsLocator found", name); if (hasLocator() && getLocator().toString().contains("%s")) return new GetElementType(fillByTemplate(getLocator(), name), this).get(Clickable.class); if (allLabels() != null) return allLabels().getLocator().toString().contains("%s") ? new GetElementType(fillByTemplate(allLabels().getLocator(), name), this).get(Clickable.class) : getFromList(allLabels().avatar.searchAll().getElements(), name); List<WebElement> elements = getAvatar().searchAll().getElements(); WebElement element = elements.get(0); if (elements.size() == 1 && element.getTagName().equals("select")) if (getSelector().getOptions().size() > 0) { getSelector().selectByVisibleText(name); return null; } else//from w w w . ja v a 2s.c o m throw exception("<select> tag has no <option> tags. Please Clarify element locator (%s)", this); if (elements.size() == 1 && element.getTagName().equals("ul")) elements = element.findElements(By.tagName("li")); return getFromList(elements, name); }
From source file:com.epam.jdi.uitests.web.selenium.elements.complex.BaseSelector.java
License:Open Source License
protected Clickable getElement(int num) { if (!hasLocator() && allLabels() == null) throw exception("Can't find option '%s'. No optionsNamesLocator and allLabelsLocator found", num); if (allLabels() != null) return selectFromList(allLabels().avatar.searchAll().getElements(), num); if (getLocator().toString().contains("%s")) return new GetElementType(fillByTemplate(getLocator(), num), this).get(Clickable.class); List<WebElement> elements = getAvatar().searchAll().getElements(); WebElement element = elements.get(0); if (elements.size() == 1 && element.getTagName().equals("select")) if (getSelector().getOptions().size() > 0) { getSelector().selectByIndex(num - 1); return null; } else//from w w w . java 2 s. c o m throw exception("<select> tag has no <option> tags. Please Clarify element locator (%s)", this); if (elements.size() == 1 && element.getTagName().equals("ul")) elements = element.findElements(By.tagName("li")); return selectFromList(elements, num); }
From source file:com.epam.jdi.uitests.web.selenium.elements.complex.table.Table.java
License:Open Source License
public Table() { this(By.tagName("table")); //GetFooterFunc = t => t.FindElements(By.xpath("//tfoot/tr/td")).Select(el => el.Text).ToArray(); }
From source file:com.epam.jdi.uitests.web.selenium.elements.pageobjects.annotations.WebAnnotationsUtil.java
License:Open Source License
public static By findByToBy(FindBy locator) { if (locator == null) return null; if (!locator.id().isEmpty()) return By.id(locator.id()); if (!locator.className().isEmpty()) return By.className(locator.className()); if (!locator.xpath().isEmpty()) return By.xpath(locator.xpath()); if (!locator.css().isEmpty()) return By.cssSelector(locator.css()); if (!locator.linkText().isEmpty()) return By.linkText(locator.linkText()); if (!locator.name().isEmpty()) return By.name(locator.name()); if (!locator.partialLinkText().isEmpty()) return By.partialLinkText(locator.partialLinkText()); if (!locator.tagName().isEmpty()) return By.tagName(locator.tagName()); return null;/* w w w . j ava 2 s. c o m*/ }
From source file:com.epam.jdi.uitests.web.selenium.elements.pageobjects.annotations.WebAnnotationsUtil.java
License:Open Source License
public static By findByToBy(Tag locator) { if (locator == null) return null; return By.tagName(locator.value()); }