Class JQuery

  • All Implemented Interfaces:
    java.lang.Iterable<JQuery>

    public class JQuery
    extends ClientWidget
    implements java.lang.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

    • Constructor Summary

      Constructors 
      Constructor Description
      JQuery​(java.lang.String uuid)  
      JQuery​(java.lang.StringBuffer out)  
      JQuery​(java.lang.StringBuffer out, java.lang.String script)  
      JQuery​(ClientWidget el)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String attr​(java.lang.String name)
      Returns the attribute value from the given name.
      JQuery children()
      Returns the child element in JQuery object.
      JQuery children​(java.lang.String selector)
      Returns the child element in JQuery object.
      JQuery contents()
      Returns the children of each element in JQuery object.
      java.lang.String css​(java.lang.String name)
      Returns the CSS value from the given name.
      JQuery eq​(int index)
      proxy for jQuery eq method
      boolean exists()
      Returns whether the widget exists or not.
      JQuery filter​(java.lang.String selector)
      Filter the element from the given selector.
      JQuery find​(java.lang.String selector)
      Finds the element from the given selector.
      JQuery first()
      Returns the first element in JQuery object.
      Element get​(int index)
      proxy for jQuery get method
      boolean hasClass​(java.lang.String className)
      Returns whether includes the className.
      int height()
      Returns the current computed height for the first element.
      java.lang.String html()
      Returns the html content(innerHTML)
      int innerHeight()
      Returns the current computed height for the first element, including padding but not border.
      int innerWidth()
      Returns the current computed width for the first element, including padding but not border.
      boolean is​(java.lang.String selector)
      check the jquery element match the selector.
      boolean isVisible()
      a short cut for visble
      java.util.Iterator<JQuery> iterator()  
      JQuery last()
      Returns the last element in JQuery object.
      int length()
      Returns the length of the array from the jQuery object.
      JQuery next()
      Returns the next element in JQuery object.
      int offsetLeft()
      Returns the current computed offsetLeft for the first element
      int offsetTop()
      Returns the current computed offsetTop for the first element
      int outerHeight()
      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 outerWidth()
      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
      JQuery parent()
      Returns the parent element in JQuery object.
      JQuery parent​(java.lang.String selector)
      Returns the parent element in JQuery object.
      JQuery parents​(java.lang.String selector)
      Returns the parents element in JQuery object.
      int positionLeft()
      Returns the current computed positionLeft (the offsetLeft relative to the parent) for the first element
      int positionTop()
      Returns the current computed positionTop (the offsetTop relative to the parent) for the first element
      JQuery prev()
      Returns the previous element in JQuery object.
      void remove()  
      static int scrollbarWidth()
      Returns the scrollbar width.
      int scrollHeight()
      Note:This not a jQuery base method.
      int scrollLeft()
      getter for scrollLeft if multiple result , will receive first value.
      void scrollLeft​(int value)
      setter for scrollLeft
      int scrollTop()
      getter for scrollTop if multiple result , will receive first value.
      void scrollTop​(int value)
      setter for scrollTop
      int scrollWidth()
      Note:This not a jQuery base method.
      java.lang.String text()
      Returns the text content
      org.openqa.selenium.By toBy()
      Returns the element as By element, if possible.
      Element toElement()
      Returns the element from this client widget.
      Widget toWidget()
      translate to widget.
      java.lang.String val()
      Returns the current value of the first element in the set of matched elements.
      int width()
      Returns the current computed width for the first element.
      ZK zk()
      Switches to the ZK object.
      • 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 Detail

      • JQuery

        public JQuery​(java.lang.String uuid)
      • JQuery

        public JQuery​(java.lang.StringBuffer out,
                      java.lang.String script)
      • JQuery

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

      • css

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

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

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

        public boolean is​(java.lang.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​(java.lang.String selector)
        Finds the element from the given selector.
        Parameters:
        selector - the JQuery allowed.
      • filter

        public JQuery filter​(java.lang.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​(java.lang.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​(java.lang.String selector)
        Returns the parent element in JQuery object.
      • parents

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

        public java.lang.String text()
        Returns the text content
      • html

        public java.lang.String html()
        Returns the html content(innerHTML)
      • val

        public java.lang.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
      • eq

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

        public void remove()
      • iterator

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

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