Package org.zkoss.test.webdriver.ztl
Class JQuery
- java.lang.Object
-
- org.openqa.selenium.By
-
- org.zkoss.test.webdriver.ztl.ClientWidget
-
- org.zkoss.test.webdriver.ztl.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
-
Fields inherited from class org.zkoss.test.webdriver.ztl.ClientWidget
_out
-
-
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.Stringattr(java.lang.String name)Returns the attribute value from the given name.JQuerychildren()Returns the child element in JQuery object.JQuerychildren(java.lang.String selector)Returns the child element in JQuery object.JQuerycontents()Returns the children of each element in JQuery object.java.lang.Stringcss(java.lang.String name)Returns the CSS value from the given name.JQueryeq(int index)proxy for jQuery eq methodbooleanexists()Returns whether the widget exists or not.JQueryfilter(java.lang.String selector)Filter the element from the given selector.JQueryfind(java.lang.String selector)Finds the element from the given selector.JQueryfirst()Returns the first element in JQuery object.Elementget(int index)proxy for jQuery get methodbooleanhasClass(java.lang.String className)Returns whether includes the className.intheight()Returns the current computed height for the first element.java.lang.Stringhtml()Returns the html content(innerHTML)intinnerHeight()Returns the current computed height for the first element, including padding but not border.intinnerWidth()Returns the current computed width for the first element, including padding but not border.booleanis(java.lang.String selector)check the jquery element match the selector.booleanisVisible()a short cut for visblejava.util.Iterator<JQuery>iterator()JQuerylast()Returns the last element in JQuery object.intlength()Returns the length of the array from the jQuery object.JQuerynext()Returns the next element in JQuery object.intoffsetLeft()Returns the current computed offsetLeft for the first elementintoffsetTop()Returns the current computed offsetTop for the first elementintouterHeight()Returns the current computed height for the first element, including padding and border.intouterHeight(boolean includeMargin)Returns the current computed height for the first element, including padding and border, it will including margin, if trueintouterWidth()Returns the current computed width for the first element, including padding and border.intouterWidth(boolean includeMargin)Returns the current computed width for the first element, including padding and border, it will including margin, if trueJQueryparent()Returns the parent element in JQuery object.JQueryparent(java.lang.String selector)Returns the parent element in JQuery object.JQueryparents(java.lang.String selector)Returns the parents element in JQuery object.intpositionLeft()Returns the current computed positionLeft (the offsetLeft relative to the parent) for the first elementintpositionTop()Returns the current computed positionTop (the offsetTop relative to the parent) for the first elementJQueryprev()Returns the previous element in JQuery object.voidremove()static intscrollbarWidth()Returns the scrollbar width.intscrollHeight()Note:This not a jQuery base method.intscrollLeft()getter for scrollLeft if multiple result , will receive first value.voidscrollLeft(int value)setter for scrollLeftintscrollTop()getter for scrollTop if multiple result , will receive first value.voidscrollTop(int value)setter for scrollTopintscrollWidth()Note:This not a jQuery base method.java.lang.Stringtext()Returns the text contentorg.openqa.selenium.BytoBy()Returns the element as By element, if possible.ElementtoElement()Returns the element from this client widget.WidgettoWidget()translate to widget.java.lang.Stringval()Returns the current value of the first element in the set of matched elements.intwidth()Returns the current computed width for the first element.ZKzk()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
-
-
-
-
Constructor Detail
-
JQuery
public JQuery(java.lang.String uuid)
-
JQuery
public JQuery(ClientWidget el)
-
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:ClientWidgetReturns the element as By element, if possible.- Specified by:
toByin classClientWidget
-
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:ClientWidgetReturns the element from this client widget.- Specified by:
toElementin classClientWidget
-
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:
iteratorin interfacejava.lang.Iterable<JQuery>
-
toWidget
public Widget toWidget()
translate to widget. (a shortcut for new Widget($obj) );- Returns:
-
-