Class JQuery

java.lang.Object
org.openqa.selenium.By
org.zkoss.test.webdriver.ztl.ClientWidget
org.zkoss.test.webdriver.ztl.JQuery
All Implemented Interfaces:
Iterable<JQuery>

public class JQuery extends ClientWidget implements Iterable<JQuery>
A simulator of JQuery client side object, which wraps the JQuery client side API.
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
    JQuery(String uuid)
     
     
    JQuery(StringBuffer out, String script)
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    attr(String name)
    Returns the attribute value from the given name.
    Returns the child element in JQuery object.
    children(String selector)
    Returns the child element in JQuery object.
    Returns the children of each element in JQuery object.
    css(String name)
    Returns the CSS value from the given name.
    eq(int index)
    proxy for jQuery eq method
    boolean
    Returns whether the widget exists or not.
    filter(String selector)
    Filter the element from the given selector.
    find(String selector)
    Finds the element from the given selector.
    Returns the first element in JQuery object.
    get(int index)
    proxy for jQuery get method
    boolean
    hasClass(String className)
    Returns whether includes the className.
    int
    Returns the current computed height for the first element.
    Returns the html content(innerHTML)
    int
    Returns the current computed height for the first element, including padding but not border.
    int
    Returns the current computed width for the first element, including padding but not border.
    boolean
    is(String selector)
    check the jquery element match the selector.
    boolean
    a short cut for visble
     
    Returns the last element in JQuery object.
    int
    Returns the length of the array from the jQuery object.
    Returns the next element in JQuery object.
    int
    Returns the current computed offsetLeft for the first element
    int
    Returns the current computed offsetTop for the first element
    int
    Returns the current computed height for the first element, including padding and border.
    int
    outerHeight(boolean includeMargin)
    Returns the current computed height for the first element, including padding and border, it will including margin, if true
    int
    Returns the current computed width for the first element, including padding and border.
    int
    outerWidth(boolean includeMargin)
    Returns the current computed width for the first element, including padding and border, it will including margin, if true
    Returns the parent element in JQuery object.
    parent(String selector)
    Returns the parent element in JQuery object.
    parents(String selector)
    Returns the parents element in JQuery object.
    int
    Returns the current computed positionLeft (the offsetLeft relative to the parent) for the first element
    int
    Returns the current computed positionTop (the offsetTop relative to the parent) for the first element
    Returns the previous element in JQuery object.
    void
     
    static int
    Returns the scrollbar width.
    int
    Note:This not a jQuery base method.
    int
    getter for scrollLeft if multiple result , will receive first value.
    void
    scrollLeft(int value)
    setter for scrollLeft
    int
    getter for scrollTop if multiple result , will receive first value.
    void
    scrollTop(int value)
    setter for scrollTop
    int
    Note:This not a jQuery base method.
    Returns the text content
    org.openqa.selenium.By
    Returns the element as By element, if possible.
    Returns the element from this client widget.
    translate to widget.
    val()
    Returns the current value of the first element in the set of matched elements.
    int
    Returns the current computed width for the first element.
    zk()
    Switches to the ZK object.

    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

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Constructor Details

  • Method Details

    • css

      public String css(String name)
      Returns the CSS value from the given name.
      Parameters:
      name - CSS name.
    • attr

      public String attr(String name)
      Returns the attribute value from the given name.
      Parameters:
      name - attribute name of the element.
    • hasClass

      public boolean hasClass(String className)
      Returns whether includes the className.
      Parameters:
      className - the CSS class name.
    • is

      public boolean is(String selector)
      check the jquery element match the selector. (We port this from jQuery);
      Parameters:
      selector - the JQuery allowed
      Returns:
    • isVisible

      public boolean isVisible()
      a short cut for visble
    • find

      public JQuery find(String selector)
      Finds the element from the given selector.
      Parameters:
      selector - the JQuery allowed.
    • filter

      public JQuery filter(String selector)
      Filter the element from the given selector.
      Parameters:
      selector - the JQuery allowed.
    • first

      public JQuery first()
      Returns the first element in JQuery object.
    • last

      public JQuery last()
      Returns the last element in JQuery object.
    • prev

      public JQuery prev()
      Returns the previous element in JQuery object.
    • next

      public JQuery next()
      Returns the next element in JQuery object.
    • children

      public JQuery children()
      Returns the child element in JQuery object.
    • children

      public JQuery children(String selector)
      Returns the child element in JQuery object.
    • contents

      public JQuery contents()
      Returns the children of each element in JQuery object. The .contents() method can also be used to get the content document of an iframe, if the iframe is on the same domain as the main page.
    • parent

      public JQuery parent()
      Returns the parent element in JQuery object.
    • parent

      public JQuery parent(String selector)
      Returns the parent element in JQuery object.
    • parents

      public JQuery parents(String selector)
      Returns the parents element in JQuery object.
    • text

      public String text()
      Returns the text content
    • html

      public String html()
      Returns the html content(innerHTML)
    • val

      public String val()
      Returns the current value of the first element in the set of matched elements.
      Returns:
    • height

      public int height()
      Returns the current computed height for the first element.
    • width

      public int width()
      Returns the current computed width for the first element.
    • innerHeight

      public int innerHeight()
      Returns the current computed height for the first element, including padding but not border.
    • innerWidth

      public int innerWidth()
      Returns the current computed width for the first element, including padding but not border.
    • outerWidth

      public int outerWidth()
      Returns the current computed width for the first element, including padding and border.
    • outerWidth

      public int outerWidth(boolean includeMargin)
      Returns the current computed width for the first element, including padding and border, it will including margin, if true
      Parameters:
      includeMargin -
    • outerHeight

      public int outerHeight()
      Returns the current computed height for the first element, including padding and border.
    • outerHeight

      public int outerHeight(boolean includeMargin)
      Returns the current computed height for the first element, including padding and border, it will including margin, if true
      Parameters:
      includeMargin -
    • length

      public int length()
      Returns the length of the array from the jQuery object.
    • zk

      public ZK zk()
      Switches to the ZK object.
    • 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
    • scrollbarWidth

      public static int scrollbarWidth()
      Returns the scrollbar width.
    • exists

      public boolean exists()
      Returns whether the widget exists or not.
    • offsetLeft

      public int offsetLeft()
      Returns the current computed offsetLeft for the first element
    • offsetTop

      public int offsetTop()
      Returns the current computed offsetTop for the first element
    • positionLeft

      public int positionLeft()
      Returns the current computed positionLeft (the offsetLeft relative to the parent) for the first element
      Returns:
    • positionTop

      public int positionTop()
      Returns the current computed positionTop (the offsetTop relative to the parent) for the first element
      Returns:
    • scrollTop

      public int scrollTop()
      getter for scrollTop if multiple result , will receive first value.
      Returns:
    • scrollTop

      public void scrollTop(int value)
      setter for scrollTop
      Parameters:
      value -
    • scrollLeft

      public int scrollLeft()
      getter for scrollLeft if multiple result , will receive first value.
      Returns:
    • scrollLeft

      public void scrollLeft(int value)
      setter for scrollLeft
      Parameters:
      value -
    • scrollHeight

      public int scrollHeight()
      Note:This not a jQuery base method. just a short cut ,in javascript's world equals get(0).scrollHeight
      Returns:
    • scrollWidth

      public int scrollWidth()
      Note:This not a jQuery base method. just a short cut ,in javascript's world equals get(0).scrollWidth
      Returns:
    • get

      public Element get(int index)
      proxy for jQuery get method
      Parameters:
      index -
      Returns:
      Element the dom element
    • toElement

      public Element toElement()
      Description copied from class: ClientWidget
      Returns the element from this client widget.
      Specified by:
      toElement in class ClientWidget
    • eq

      public JQuery eq(int index)
      proxy for jQuery eq method
      Parameters:
      index -
      Returns:
    • remove

      public void remove()
    • iterator

      public Iterator<JQuery> iterator()
      Specified by:
      iterator in interface Iterable<JQuery>
    • toWidget

      public Widget toWidget()
      translate to widget. (a shortcut for new Widget($obj) );
      Returns: