API Docs for: 2.2.0
Show:

Elements Class

Defined in: lib/elements.js:2

This class is used for control elements.

Methods

attr

(
  • name
  • done
)
String public

Defined in lib/elements.js:273

get attribute value (first element)

Parameters:

  • name String

    attribute name

  • done Function

    callback function

Returns:

String:

clear

(
  • done
)
This public

Defined in lib/elements.js:345

clear input or textarea

Parameters:

  • done Function

    callback function

Returns:

This:

click

(
  • [key]
  • done
)
public

Defined in lib/elements.js:562

click to element

Parameters:

  • [key] String optional
  • done Function

    callback function

constructor

(
  • browser
  • [using]
  • value
)
private

Defined in lib/elements.js:11

init elements instance

Parameters:

  • browser Browser

    Browser instance

  • [using] String optional

    find mode: class name|css selector|id|name|link text|partial link text|tag name|xpath

  • value String

    find pattern

css

(
  • name
  • done
)
String public

Defined in lib/elements.js:316

get css value (first element)

Parameters:

  • name String

    css name

  • done Function

    callback function

Returns:

String:

dblClick

(
  • done
)
public

Defined in lib/elements.js:582

double click to element

Parameters:

  • done Function

    callback function

displayed

(
  • done
)
Boolean public

Defined in lib/elements.js:395

check element displayed (first element)

Parameters:

  • done Function

    callback function

Returns:

Boolean:

doubleClick

(
  • done
)
public

Defined in lib/elements.js:595

double click to element

Parameters:

  • done Function

    callback function

dragDropTo

(
  • selector
  • [x]
  • [y]
  • done
)
public

Defined in lib/elements.js:608

drag the element drop to another element

Parameters:

  • selector Elements
  • [x] Number optional
  • [y] Number optional
  • done Function

    callback function

enabled

(
  • done
)
Boolean public

Defined in lib/elements.js:408

check element enabled (first element)

Parameters:

  • done Function

    callback function

Returns:

Boolean:

equal

(
  • elements
  • done
)
Boolean public

Defined in lib/elements.js:885

test if two elements refer to the same DOM element.

Parameters:

  • elements Elements | String
  • done Function

    callback function

Returns:

Boolean:

execCmd

(
  • cmd
  • [pathData]
  • [data]
  • done
)
Object public

Defined in lib/elements.js:107

execute protocal command with this elements

Parameters:

  • cmd String

    protocal command, defined in command.js

  • [pathData] Object optional

    replace the path parameters, no need to add sessionId

  • [data] Object optional

    send data to protocal api

  • done Function

    callback function

Returns:

Object:

the return object from webdriver server

find

(
  • [using]
  • value
  • done
)
Elments public

Defined in lib/elements.js:846

find all child elements

Parameters:

  • [using] String optional

    find mode: class name|css selector|id|name|link text|partial link text|tag name|xpath

  • value String

    find pattern

  • done Function

    callback function

Returns:

Elments:

first

(
  • [changeSelf]
)
public

Defined in lib/elements.js:237

get new first element

Parameters:

  • [changeSelf] Boolean optional

get

(
  • index
  • [changeSelf]
)
public

Defined in lib/elements.js:225

get new element by index

Parameters:

  • index Number
  • [changeSelf] Boolean optional

init

(
  • done
)
private

Defined in lib/elements.js:28

init elements

Parameters:

  • done Function

    callback function

last

(
  • [changeSelf]
)
public

Defined in lib/elements.js:248

get new last element

Parameters:

  • [changeSelf] Boolean optional

log

(
  • type
  • message
)
public

Defined in lib/elements.js:96

save log

Parameters:

  • type COMMAND | DATA | RESULT | ERROR | WARNING | INFO

    log type

  • message Object

    log message

mouseMove

(
  • [x]
  • [y]
  • done
)
public

Defined in lib/elements.js:526

send mousemove (first element)

Parameters:

  • [x] Number | Object optional
  • [y] Number optional
  • done Function

    callback function

offset

(
  • [isInview]
  • done
)
Object public

Defined in lib/elements.js:356

get offset of element (first element)

Parameters:

  • [isInview] Boolean optional
  • done Function

    callback function

Returns:

Object:

return {x:1,y:1}

prop

(
  • done
)
Object public

Defined in lib/elements.js:303

get rect(first element)

Parameters:

  • done Function

    callback function

Returns:

Object:

return rect info

prop

(
  • name
  • done
)
Object public

Defined in lib/elements.js:289

get property value (first element)

Parameters:

  • name String

    attribute name

  • done Function

    callback function

Returns:

Object:

return proerty value

scrollTo

(
  • [x]
  • [y]
  • done
)
public

Defined in lib/elements.js:664

scroll element to x, y

Parameters:

  • [x] Number | Object optional
  • [y] Number optional
  • done Function

    callback function

select

(
  • value
  • done
)
Boolean public

Defined in lib/elements.js:434

select option

Parameters:

  • value Number | String | Object

    {type:'index', value:'test'} type:index | value | text

  • done Function

    callback function

Returns:

Boolean:

selected

(
  • done
)
Boolean public

Defined in lib/elements.js:421

check element selected (first element)

Parameters:

  • done Function

    callback function

Returns:

Boolean:

sendActions

(
  • type
  • params
  • done
)
public

Defined in lib/elements.js:817

send actions from element

Parameters:

  • type String
  • params Object
  • done Function

    callback function

sendKeys

(
  • text
  • done
)
public

Defined in lib/elements.js:484

send keys to element

Parameters:

  • text String
  • done Function

    callback function

size

(
  • done
)
Object public

Defined in lib/elements.js:382

get size of element (first element)

Parameters:

  • done Function

    callback function

Returns:

Object:

return {width:1, height:1}

sleep

(
  • ms
  • done
)
public

Defined in lib/elements.js:164

sleep sync

Parameters:

  • ms Number

    millisecond

  • done Function

    callback function

slice

(
  • start
  • end
  • [changeSelf]
)
public

Defined in lib/elements.js:196

get new element from start to end

Parameters:

  • start Number
  • end Number
  • [changeSelf] Boolean optional

submit

(
  • done
)
public

Defined in lib/elements.js:638

submit form

Parameters:

  • done Function

    callback function

tagName

(
  • done
)
String public

Defined in lib/elements.js:260

get tagName (first element)

Parameters:

  • done Function

    callback function

Returns:

String:

text

(
  • done
)
String public

Defined in lib/elements.js:332

get text (first element)

Parameters:

  • done Function

    callback function

Returns:

String:

toJSON

(
  • first
)
Object | Array public

Defined in lib/elements.js:175

get webdriver ELEMENT object

Parameters:

  • first Boolean

Returns:

Object | Array:

[{ELEMENT: 1}] | {ELEMENT: 1}

touchClick

(
  • done
)
public

Defined in lib/elements.js:704

touch click to element

Parameters:

  • done Function

    callback function

touchDblClick

(
  • done
)
public

Defined in lib/elements.js:717

touch double click to element

Parameters:

  • done Function

    callback function

touchDoublelClick

(
  • done
)
public

Defined in lib/elements.js:730

touch double click to element

Parameters:

  • done Function

    callback function

touchFlick

(
  • x
  • y
  • speed
  • done
)
public

Defined in lib/elements.js:782

touch flick from element

Parameters:

  • x Number
  • y Number
  • speed Number
  • done Function

    callback function

touchLongClick

(
  • done
)
public

Defined in lib/elements.js:740

touch long click to element

Parameters:

  • done Function

    callback function

touchScroll

(
  • x
  • y
  • done
)
public

Defined in lib/elements.js:753

touch scroll from element

Parameters:

  • x Number
  • y Number
  • done Function

    callback function

uploadFile

(
  • localPath
  • done
)
public

Defined in lib/elements.js:648

upload file to browser machine, then set to this element

Parameters:

  • localPath String
  • done Function

    callback function

val

(
  • [text]
  • done
)
public

Defined in lib/elements.js:503

get or set value

Parameters:

  • [text] String optional
  • done Function

    callback function