Class Element

java.lang.Object
org.openqa.selenium.By
org.zkoss.test.webdriver.ztl.ClientWidget
org.zkoss.test.webdriver.ztl.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

    Fields inherited from class org.zkoss.test.webdriver.ztl.ClientWidget

    _out
  • Constructor Summary

    Constructors
    Constructor
    Description
    Element(String script)
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns whether the element exists or not.
    Returns the firstChild of the element.
    get(String name)
    Returns the result of the evaluated name.
    boolean
    is(String name)
    Returns the boolean value of the evaluated name.
    Returns the nextSibling of the element.
    Returns the parentNode of the element.
    void
    set(String name, boolean value)
    Sets the boolean value to the evaluated name.
    void
    set(String name, int value)
    Sets the number value to the evaluated name.
    void
    set(String name, String value)
    Sets the string value to the evaluated name.
    org.openqa.selenium.By
    Returns the element as By element, if possible.
    Returns the element from this client widget.

    Methods inherited from class org.zkoss.test.webdriver.ztl.ClientWidget

    eval, eval, findElements, isBlank, isEmpty, toLocator, toString, toUpperCase

    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 Details

  • Method Details

    • set

      public void set(String name, 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(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(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 String get(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(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.
    • toElement

      public Element toElement()
      Description copied from class: ClientWidget
      Returns the element from this client widget.
      Specified by:
      toElement in class ClientWidget
    • 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