Example usage for org.openqa.selenium WebElement getTagName

List of usage examples for org.openqa.selenium WebElement getTagName

Introduction

In this page you can find the example usage for org.openqa.selenium WebElement getTagName.

Prototype

String getTagName();

Source Link

Document

Get the tag name of this element.

Usage

From source file:org.julianharty.accessibility.automation.KeyboardHelpers.java

License:Apache License

/**
 * A simple helper method to log the termination condition.
 * //from   www  .  ja va2 s .  com
 * The main reason this has been created is to reduce duplication in the
 * main method. 
 * TODO (jharty): This code is ugly and probably worth reassessing at some
 * point.
 * @param whyTerminated a text-based description of which valid termination
 * was detected. Useful while we're trying to improve the loop detection.
 * @param currentElement the current element on the web page
 * @param tabsIssued the number of tab keys issued so far
 */
private static void logTerminationCondition(String whyTerminated, WebElement currentElement, int tabsIssued) {
    LOG.info(String.format("Terminating tabThroughWebPage because [%s], tabbed through %d elements",
            whyTerminated, tabsIssued));
    LOG.info(String.format("Tag name %s WebElement %s name %s text %s value %s", currentElement.getTagName(),
            currentElement.hashCode(), currentElement.toString(), currentElement.getText(),
            getValueFromWebdriverIfAvailable(currentElement)));
}

From source file:org.jwatter.browser.WebDriverWebAutomationFramework.java

License:Apache License

@Override
protected WebElement findTextareaWithId(String id) throws NoSuchElementException {
    WebElement element = findElementWithId(id);
    if (!"textarea".equals(element.getTagName())) {
        throw new NoSuchElementException("textarea", "id", id);
    }/* ww w . j ava2 s  .  c  o m*/
    return element;
}

From source file:org.jwatter.browser.WebDriverWebAutomationFramework.java

License:Apache License

@Override
protected WebElement findDropDownMenuWithId(String id) throws NoSuchElementException {
    WebElement element = findElementWithId(id);
    if (!"select".equals(element.getTagName())) {
        throw new NoSuchElementException("select", "id", id);
    }//from  w  w  w . j  a  v  a2  s  . com
    return element;
}

From source file:org.jwatter.browser.WebDriverWebAutomationFramework.java

License:Apache License

@Override
protected WebElement findTextareaWithName(String name, int which)
        throws NoSuchElementException, AmbiguousElementException {
    return new ElementSelector<WebElement>() {
        @Override/*from w w  w  .j  a v a  2s . com*/
        public boolean eval(WebElement element) {
            return "textarea".equals(element.getTagName());
        }
    }.filter(browser.findElements(By.name(name)), which, "textarea", "name", name);
}

From source file:org.jwatter.browser.WebDriverWebAutomationFramework.java

License:Apache License

@Override
protected WebElement findDropDownMenuWithName(String name, int which)
        throws NoSuchElementException, AmbiguousElementException {
    return new ElementSelector<WebElement>() {
        @Override//from   w ww  . j  a  v a2 s. co m
        public boolean eval(WebElement element) {
            return "select".equals(element.getTagName());
        }
    }.filter(browser.findElements(By.name(name)), which, "select", "name", name);
}

From source file:org.jwatter.browser.WebDriverWebAutomationFramework.java

License:Apache License

@Override
protected WebElement findSpanWithClass(String cssclass, int which)
        throws NoSuchElementException, AmbiguousElementException {
    return new ElementSelector<WebElement>() {
        @Override/* w  w w.ja v  a2 s.co m*/
        public boolean eval(WebElement element) {
            return "span".equals(element.getTagName());
        }
    }.filter(browser.findElements(By.className(cssclass)), which, "span", "class", cssclass);
}

From source file:org.jwatter.browser.WebDriverWebAutomationFramework.java

License:Apache License

protected List<WebElement> findSpansWithClass(String cssclass) {
    return new ElementSelector<WebElement>() {
        @Override//  w w  w .jav a  2s .  c  o  m
        public boolean eval(WebElement element) {
            return "span".equals(element.getTagName());
        }
    }.filter(browser.findElements(By.className(cssclass)));
}

From source file:org.jwatter.browser.WebDriverWebAutomationFramework.java

License:Apache License

protected static boolean isTextInputElement(WebElement element) {
    return "input".equals(element.getTagName()) && "text".equals(element.getAttribute("type"));
}

From source file:org.jwatter.browser.WebDriverWebAutomationFramework.java

License:Apache License

protected static boolean isPasswordInputElement(WebElement element) {
    return "input".equals(element.getTagName()) && "password".equals(element.getAttribute("type"));
}

From source file:org.jwatter.browser.WebDriverWebAutomationFramework.java

License:Apache License

protected static boolean isCheckboxElement(WebElement element) {
    return "input".equals(element.getTagName()) && "checkbox".equals(element.getAttribute("type"));
}