Marionette JS Client

API Docs for: 1.7.1
Show:

Marionette.Element Class

Creates an element reference based on an id and a client instance. You should never need to manually create an instance of element.

Use findElement or findElements to create instance(s) of this class.

Methods

_sendCommand

(
  • command
  • responseKey
  • callback
)
Object private chainable

Sends remote command processes the result. Appends element id to each command.

Parameters:

  • command Object

    marionette request.

  • responseKey String

    key in the response to pass to callback.

  • callback Function

    callback function receives the result of response[responseKey] as its first argument.

Returns:

Object:

self.

clear

(
  • callback
)
Object

Clears element.

Parameters:

Returns:

Object:

self.

click

(
  • callback
)
Object

Clicks element.

Parameters:

Returns:

Object:

self.

cssProperty

(
  • property
  • callback
)
Object

Returns the value of the specified CSS property name.

Parameters:

  • property String

    css property.

  • callback Function

    [Error err, String value].

Returns:

Object:

self.

displayed

(
  • callback
)
Object

Checks if element is displayed.

Parameters:

Returns:

Object:

self.

enabled

(
  • callback
)
Object

Checks if element is enabled.

Parameters:

Returns:

Object:

self.

equals

(
  • element
)
Boolean

Checks to see if two elements are equal

Parameters:

Returns:

Boolean:

true when equal.

findElement

(
  • query
  • method
  • callback
)
Object

Finds a single child of this element.

Parameters:

Returns:

Object:

self.

findElements

(
  • query
  • method
  • callback
)
Array

Finds a all children of this element that match a pattern.

Parameters:

Returns:

Array:

elements matched the query string.

getAttribute

(
  • attr
  • callback
)
String

Gets attribute value for element.

Parameters:

  • attr String

    attribtue name.

  • callback Function

    gets called with attribute's value.

Returns:

String:

the value of the Attribute.

location

(
  • callback
)
Object

Returns the dictionary with x and y location of an element.

The returned location will be in the following format:

// returned in callback or result of this call in the sync driver. { x: Number, y: Number }

Parameters:

  • callback Function

    [Error err, Object location].

Returns:

Object:

self.

rect

(
  • callback
)
Object

Returns the object with: x and y location of the element height and width of the element

Parameters:

  • callback Function

    [Error err, Object rect]

Returns:

Object:

self.

scriptWith

(
  • script
  • [args]
  • callback
)
String | Number

Shortcut method to execute a function with this element as first argument.

Parameters:

  • script Function | String

    remote script.

  • [args] Array optional

    optional arguments for script.

  • callback Function

    callback when script completes.

Returns:

String | Number:

return value of the script.

selected

(
  • callback
)
Object

Checks if element is selected.

Parameters:

Returns:

Object:

self.

sendKeys

(
  • input
  • callback
)
Object

Sends typing event keys to element.

Parameters:

Returns:

Object:

self.

size

(
  • callback
)
Object

Returns the size of a given element.

The returned size will be in the following format:

// returned in callback or result of this call in the sync driver. { x: Number, y: Number }

Parameters:

  • callback Function

    [Error err, Object size].

Returns:

Object:

self.

tagName

(
  • callback
)
String

Returns tag name of element.

Parameters:

  • callback Function

    node style [err, tagName].

Returns:

String:

tag name of element.

tap

(
  • [x]
  • [y]
  • [callback]
)
Object

Taps an element at given x and y coordinates. If no offsets are given, it will be tapped at the center of the element.

Parameters:

  • [x] Number optional

    offset for the tap.

  • [y] Number optional

    offset for the tap.

  • [callback] Function optional

    [Error err]

Returns:

Object:

self

text

(
  • callback
)
String

Gets text of element

Parameters:

Returns:

String:

text of element.