Class Element


  • public class Element
    extends ClientWidget
    A simulator of DOM element object.
    Author:
    jumperchen
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.openqa.selenium.By

        org.openqa.selenium.By.ByClassName, org.openqa.selenium.By.ByCssSelector, org.openqa.selenium.By.ById, org.openqa.selenium.By.ByLinkText, org.openqa.selenium.By.ByName, org.openqa.selenium.By.ByPartialLinkText, org.openqa.selenium.By.ByTagName, org.openqa.selenium.By.ByXPath, org.openqa.selenium.By.Remotable
    • Field Summary

    • Constructor Summary

      Constructors 
      Constructor Description
      Element​(java.lang.String script)  
      Element​(java.lang.StringBuffer out)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean exists()
      Returns whether the element exists or not.
      Element firstChild()
      Returns the firstChild of the element.
      java.lang.String get​(java.lang.String name)
      Returns the result of the evaluated name.
      boolean is​(java.lang.String name)
      Returns the boolean value of the evaluated name.
      Element nextSibling()
      Returns the nextSibling of the element.
      Element parentNode()
      Returns the parentNode of the element.
      void set​(java.lang.String name, boolean value)
      Sets the boolean value to the evaluated name.
      void set​(java.lang.String name, int value)
      Sets the number value to the evaluated name.
      void set​(java.lang.String name, java.lang.String value)
      Sets the string value to the evaluated name.
      org.openqa.selenium.By toBy()
      Returns the element as By element, if possible.
      Element toElement()
      Returns the element from this client widget.
      • Methods inherited from class org.openqa.selenium.By

        className, cssSelector, equals, findElement, getJavascriptExecutor, getWebDriver, hashCode, id, linkText, name, partialLinkText, tagName, xpath
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Element

        public Element​(java.lang.String script)
      • Element

        public Element​(java.lang.StringBuffer out)
    • Method Detail

      • set

        public void set​(java.lang.String name,
                        java.lang.String value)
        Sets the string value to the evaluated name.

        For example,

        ele.set("style.display", "none");

        Parameters:
        name - any attribute of the element.
      • set

        public void set​(java.lang.String name,
                        boolean value)
        Sets the boolean value to the evaluated name.

        For example,

        ele.set("checked", false);

        Parameters:
        name - any attribute of the element.
        value - true or false.
      • set

        public void set​(java.lang.String name,
                        int value)
        Sets the number value to the evaluated name.

        For example,

        ele.set("style.top", 12);

        Parameters:
        name - any attribute of the element.
        value - any number.
      • get

        public java.lang.String get​(java.lang.String name)
        Returns the result of the evaluated name.

        For example,

        ele.get("name"); if the ele.name is "myname", the result is "myname" being returned.

        Parameters:
        name - any attribute of the element.
      • is

        public boolean is​(java.lang.String name)
        Returns the boolean value of the evaluated name.

        For example,

        ele.is("name"); if the ele.name is "true", the result is true. Otherwise, false is assumed.

        Parameters:
        name - any attribute of the element.
        Returns:
        if true, the return value is the same as "true".
      • parentNode

        public Element parentNode()
        Returns the parentNode of the element.
      • firstChild

        public Element firstChild()
        Returns the firstChild of the element.
      • nextSibling

        public Element nextSibling()
        Returns the nextSibling of the element.
        Since:
        2.0.0
      • exists

        public boolean exists()
        Returns whether the element exists or not.
      • toBy

        public org.openqa.selenium.By toBy()
        Description copied from class: ClientWidget
        Returns the element as By element, if possible.
        Specified by:
        toBy in class ClientWidget