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
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
ConstructorsConstructorDescriptionJQuery(StringBuffer out) JQuery(StringBuffer out, String script) JQuery(ClientWidget el) -
Method Summary
Modifier and TypeMethodDescriptionReturns the attribute value from the given name.children()Returns the child element in JQuery object.Returns the child element in JQuery object.contents()Returns the children of each element in JQuery object.Returns the CSS value from the given name.eq(int index) proxy for jQuery eq methodbooleanexists()Returns whether the widget exists or not.Filter the element from the given selector.Finds the element from the given selector.first()Returns the first element in JQuery object.get(int index) proxy for jQuery get methodbooleanReturns whether includes the className.intheight()Returns the current computed height for the first element.html()Returns the html content(innerHTML)intReturns the current computed height for the first element, including padding but not border.intReturns the current computed width for the first element, including padding but not border.booleancheck the jquery element match the selector.booleana short cut for visbleiterator()last()Returns the last element in JQuery object.intlength()Returns the length of the array from the jQuery object.next()Returns the next element in JQuery object.intReturns the current computed offsetLeft for the first elementintReturns the current computed offsetTop for the first elementintReturns 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 trueintReturns 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 trueparent()Returns the parent element in JQuery object.Returns the parent element in JQuery object.Returns the parents element in JQuery object.intReturns the current computed positionLeft (the offsetLeft relative to the parent) for the first elementintReturns the current computed positionTop (the offsetTop relative to the parent) for the first elementprev()Returns the previous element in JQuery object.voidremove()static intReturns the scrollbar width.intNote:This not a jQuery base method.intgetter for scrollLeft if multiple result , will receive first value.voidscrollLeft(int value) setter for scrollLeftintgetter for scrollTop if multiple result , will receive first value.voidscrollTop(int value) setter for scrollTopintNote:This not a jQuery base method.text()Returns the text contentorg.openqa.selenium.BytoBy()Returns the element as By element, if possible.Returns the element from this client widget.toWidget()translate to widget.val()Returns the current value of the first element in the set of matched elements.intwidth()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, toUpperCaseMethods inherited from class org.openqa.selenium.By
className, cssSelector, equals, findElement, getJavascriptExecutor, getWebDriver, hashCode, id, linkText, name, partialLinkText, tagName, xpathMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
JQuery
-
JQuery
-
JQuery
-
JQuery
-
-
Method Details
-
css
Returns the CSS value from the given name.- Parameters:
name- CSS name.
-
attr
Returns the attribute value from the given name.- Parameters:
name- attribute name of the element.
-
hasClass
Returns whether includes the className.- Parameters:
className- the CSS class name.
-
is
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
Finds the element from the given selector.- Parameters:
selector- the JQuery allowed.
-
filter
Filter the element from the given selector.- Parameters:
selector- the JQuery allowed.
-
first
Returns the first element in JQuery object. -
last
Returns the last element in JQuery object. -
prev
Returns the previous element in JQuery object. -
next
Returns the next element in JQuery object. -
children
Returns the child element in JQuery object. -
children
Returns the child element in JQuery object. -
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
Returns the parent element in JQuery object. -
parent
Returns the parent element in JQuery object. -
parents
Returns the parents element in JQuery object. -
text
Returns the text content -
html
Returns the html content(innerHTML) -
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
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
proxy for jQuery get method- Parameters:
index-- Returns:
- Element the dom element
-
toElement
Description copied from class:ClientWidgetReturns the element from this client widget.- Specified by:
toElementin classClientWidget
-
eq
proxy for jQuery eq method- Parameters:
index-- Returns:
-
remove
public void remove() -
iterator
-
toWidget
translate to widget. (a shortcut for new Widget($obj) );- Returns:
-