Class: WebElement

WebElement

new WebElement(id, driver)

Element constructor
Parameters:
Name Type Description
id String Element id (e.g. returned by WebDriver#get)
driver WebDriver
Source:

Members

attr

Get the value of an element's attribute via jQuery.attr method. See also selenium WebElement#getAttr method.
Source:

css

Get the value of an element's css property via jQuery.css method. See also selenium WebElement#getCssProp method.
Source:

element :Object

element object works like WebDriver#element.
Type:
  • Object
Source:

prop

Get the value of an element's property via jQuery.prop method.
Source:

text

Get the text of an element's attribute via jQuery.text method. See also selenium WebElement#getText method.
Source:

Methods

clear(callback(err:Error,element:WebElement))

Clear a TEXTAREA or text INPUT element's value.
Parameters:
Name Type Description
callback(err:Error,element:WebElement) function
Source:

click(callback(err:Error,element:WebElement))

Click on an element.
Parameters:
Name Type Description
callback(err:Error,element:WebElement) function
Source:

describe(callback(err:Error,description:String))

Describe the identified element. This command is reserved for future use; its return type is currently undefined.
Parameters:
Name Type Description
callback(err:Error,description:String) function
Source:

get(selector, params, callback(err:Error,element:WebElement))

Find element inside current element. `selector` and `params` could accept same values as at WebDriver#get.
Parameters:
Name Type Argument Description
selector String
params Object <optional>
callback(err:Error,element:WebElement) function
Source:

getAttr(name, callback(err:Error,value:String))

Get the value of an element's attribute.
Parameters:
Name Type Description
name String Attribute's name
callback(err:Error,value:String) function
Source:

getCssProp(propName, callback(err:Error,value:String))

Get the value of an element's computed CSS property.
Parameters:
Name Type Description
propName String The CSS property name, not the JavaScript property name (e.g. background-color instead of backgroundColor).
callback(err:Error,value:String) function
Source:

getList(selector, params, callback(err:Error,element:WebElement[]))

Find elements inside current element. `selector` and `params` could accept same values as at WebDriver#get.
Parameters:
Name Type Argument Description
selector String
params Object <optional>
callback(err:Error,element:WebElement[]) function
Source:

getTagName(callback(err:Error,tagName:String))

Get element's tag name.
Parameters:
Name Type Description
callback(err:Error,tagName:String) function
Source:

getText(callback(err:Error,text:String))

Get the visible text (if element is invisible the result will be empty string) of the element.
Parameters:
Name Type Description
callback(err:Error,text:String) function
Source:

getValue(callback(err:Error,value:String))

Get value of current element (alias to getAttr('value')).
Parameters:
Name Type Description
callback(err:Error,value:String) function
Source:

isDisabled(callback(err:Error,disabled:Boolean))

Determine if an element is currently disabled using DOM Element 'disabled' property (works properly for any native controls).
Parameters:
Name Type Description
callback(err:Error,disabled:Boolean) function
Source:

isDisplayed(callback(err:Error,displayed:Boolean))

Determine if an element is currently displayed. This method avoids the problem of having to parse an element's 'style' attribute.
Parameters:
Name Type Description
callback(err:Error,displayed:Boolean) function
Source:

isEnabled(callback(err:Error,enabled:Boolean))

Determine if an element is currently enabled. This will generally return true for everything but disabled input elements. NOTE: therefore that native selenium function works properly only for inputs. See WebElement#isDisabled method which works properly for all native controls.
Parameters:
Name Type Description
callback(err:Error,enabled:Boolean) function
Source:

isSelected(callback(err:Error,selected:Boolean))

Determine if a checkbox or radiobutton is currently selected.
Parameters:
Name Type Description
callback(err:Error,selected:Boolean) function
Source:

mouseDown(button, callback(err:Error,driver:WebDriver))

Move to the current element and down mouse button. `button` accepts same values as at WebDriver#mouseDown.
Parameters:
Name Type Argument Description
button String <optional>
callback(err:Error,driver:WebDriver) function
Source:

mouseUp(button, callback(err:Error,driver:WebDriver))

Move to the current element and up mouse button. `button` accepts same values as at WebDriver#mouseDown.
Parameters:
Name Type Argument Description
button String <optional>
callback(err:Error,driver:WebDriver) function
Source:

moveTo(offset, callback(err:Error,element:WebElement))

Move the mouse by an offset of the current element. If the element is not visible, it will be scrolled into view.
Parameters:
Name Type Description
offset Object Object with x, y offsets (relative to the top-left corner of the element) keys. If offset is not set the mouse will be moved to the center of the element.
callback(err:Error,element:WebElement) function
Source:

sendKeys(value, params, callback(err:Error,element:WebElement))

Send a sequence of key strokes to an element.
Parameters:
Name Type Argument Description
value String
params Object <optional>
Properties
Name Type Argument Description
clear Boolean <optional>
If true then 'clear' will be called before sending keys.
callback(err:Error,element:WebElement) function
Source:

waitForDetach(callback(err:Error,driver:WebDriver))

Wait untill element will be detached from page.
Parameters:
Name Type Description
callback(err:Error,driver:WebDriver) function
Source:

waitForDisappear(callback(err:Error,driver:WebDriver))

Wait for element disappear from the page.
Parameters:
Name Type Description
callback(err:Error,driver:WebDriver) function
Source:

waitForElement(selector, params, callback(err:Error,element:WebDriver))

Wait for element appear inside current element. `selector` and `params` could accept same values as at WebDriver#waitForElement.
Parameters:
Name Type Argument Description
selector String
params Object <optional>
callback(err:Error,element:WebDriver) function
Source: