Element Class
Object representing a DOM-Element
Constructor
Item Index
Methods
- _logMethodCall
- _requestJSON
- capture
- clear
- compare
- elementHandler
- elementId
- getAbsoluteCenter
- getAttribute
- getClasses
- getCssValue
- getElement
- getElements
- getFrame
- getPosition
- getPosition
- getRelativeCenter
- getSize
- getTagName
- getText
- getValue
- hasClass
- hasElement
- hasText
- isDisabled
- isDisplayed
- isEnabled
- isEqual
- isSelected
- mouse
- screenshot deprecated
- sendKeys
- submit
- touch
Properties
- SELECTOR_CLASS static
- SELECTOR_CSS static
- SELECTOR_ID static
- SELECTOR_LINK_TEXT static
- SELECTOR_NAME static
- SELECTOR_PARTIAL static
- SELECTOR_TAG static
- SELECTOR_XPATH static
Methods
_requestJSON
-
method
-
path
-
[body]
Performs a context dependent JSON request for the current session. The result is parsed for errors.
Returns:
capture
-
[options]
Takes a screenshot of the document
Parameters:
-
[options]
Object optional-
[horizontalPadding=0]
Int optionalPadding of the document for adjustment
-
[eachFn]
Function optionalWill execute method on client before each screenshot is taken. First parameter is index of screenshot.
-
[completeFn]
Function optionalWill execute method on client after all screenshots are taken.
-
[blockOuts]
Object[] | Element[] | String[] optionalList of areas/elements that should be blocked-out
-
[blockOutColor=black]
Object optionalColor to be used for blocking-out areas {red, green, blue, alpha}
-
[wait=100]
Int optionalWait in ms before each screenshot
-
[allPadding]
Int optionalPadding for all sides
-
[hPadding]
Int optionalPadding on left and right side of the element
-
[vPadding]
Int optionalPadding on the top and on the bottom of the element
-
[leftPadding]
Int optionalPadding on the left of the element
-
[rightPadding]
Int optionalPadding on the right of the element
-
[topPadding]
Int optionalPadding on the top of the element
-
[bottomPadding]
Int optionalPadding on the bottom of the element
-
Returns:
Binary image buffer
clear
()
Clear the value of an input
compare
-
title
-
[options]
Compares the screenshot of the element with a previous screenshot, showing differences between them
Parameters:
-
title
StringUnique title for comparison
-
[options]
Object optional-
[horizontalPadding=0]
Int optionalPadding of the document for adjustment
-
[eachFn]
Function optionalWill execute method on client before each screenshot is taken. First parameter is index of screenshot.
-
[completeFn]
Function optionalWill execute method on client after all screenshots are taken.
-
[blockOuts]
Object[] | Element[] | String[] optionalList of areas/elements that should be blocked-out
-
[blockOutColor=black]
Object optionalColor to be used for blocking-out areas {red, green, blue, alpha}
-
[wait=100]
Int optionalWait in ms before each screenshot
-
[compare]
Object optionalOptions for the comparison. See Blink-Diff documentation.
-
[id=1]
Object optionalAdditional identifier to differentiate comparisons even more.
-
-
[allPadding]
Int optionalPadding for all sides
-
[hPadding]
Int optionalPadding on left and right side of the element
-
[vPadding]
Int optionalPadding on the top and on the bottom of the element
-
[leftPadding]
Int optionalPadding on the left of the element
-
[rightPadding]
Int optionalPadding on the right of the element
-
[topPadding]
Int optionalPadding on the top of the element
-
[bottomPadding]
Int optionalPadding on the bottom of the element
-
Returns:
Are the screenshots the same? (NULL if there is nothing to compare to)
elementHandler
()
Object
Gets the internal selenium handler object Direct-access. No need to wait.
Returns:
getAbsoluteCenter
()
Object
Gets the absolute center of an element
Returns:
{x: number, y: number}
getAttribute
-
attribute
Gets the value of an attribute.
Parameters:
-
attribute
String
Returns:
getCssValue
()
String
Query the value of an element's computed CSS property. The CSS property to query should be specified using the CSS property name, not the JavaScript property name (e.g. background-color instead of backgroundColor).
Returns:
getElement
-
selector
-
[selectorType='css
Gets an element via a selector. Will throw an error if the element does not exist.
Returns:
getElements
-
selector
-
[selectorType='css
Gets elements via a selector.
Returns:
getFrame
()
Object
Get the frame of an element
Returns:
{x: number, y: number, width: number, height: number}
getPosition
()
Object
Gets the position of an element in the current view
Returns:
{x: number, y: number}
getRelativeCenter
()
Object
Gets the relative center of an element
Returns:
{x: number, y: number}
getValue
()
String
Gets the value of an element.
Note: The element needs to have a 'value' attribute for this to work.
Returns:
hasClass
-
classStr
Does the element have a specific class?
Parameters:
-
classStr
String
Returns:
hasText
-
text
Does the element have a specific text-string?
Parameters:
-
text
String
Returns:
isEqual
-
element
Return true if the current element is equal to the supplied element
Parameters:
-
element
Element
Returns:
screenshot
-
[options]
Takes a screenshot of the document
Parameters:
-
[options]
Object optional
Returns:
Binary image buffer
submit
()
Submit a form element
Properties
SELECTOR_LINK_TEXT
String
static
Link text selector type, finding a link that fits the selector. The full link-text needs to match.
SELECTOR_PARTIAL
String
static
Partial-link text selector type, finding a link that partially fits the selector. Only a part of the link-text needs to match.