Taiko
Documentation

Home / API Reference

ElementWrapper

Wrapper object of all found elements. This list mimics the behaviour of Element by exposing similar methods. The call of these methods gets delegated to first element. By default, the ElementWrapper acts as a proxy to the first matching element and hence it forwards function calls that belong to Element

Instance Members

get

Parameters

retryInterval number

Retry Interval in milliseconds (defaults to global settings).


retryTimeout number

Retry Timeout in milliseconds (defaults to global settings).


Returns

All elements mathing the selector.

Array.<Element>


description

Describes the operation performed. The description is the same that is printed when performing the operation in REPL.

Examples
link('google').description // prints "'Link with text google'"
Parameters

This API does not have any parameters

Returns

Description of the current command that fetched this element(wrapper).

string


exists

Checks existence for element. exists() waits for retryTimeout before deciding that the page is loaded. (NOTE: exists() returns boolean from version 0.4.0 )

Examples
// To 'short-circuit' non existence. However this should be done only if there is no network calls/reloads.
element.exists(0,0)
link('google').exists()
link('google').exists(1000)
Parameters

retryInterval number

Retry Interval in milliseconds (defaults to global settings).


retryTimeout number

Retry Timeout in milliseconds (defaults to global settings).


Returns

true if exists, else false.

boolean


text

Gets the innerText of the element

Parameters

This API does not have any parameters

Returns

innerText of the element

string


isVisible

Checks if element is visually visible. isVisible() is false when the element is overshadowed by another element, or if the element is outside the viewport.

Parameters

retryInterval number

Retry Interval in milliseconds (defaults to global settings).


retryTimeout number

Retry Timeout in milliseconds (defaults to global settings).


Returns

true if visible, else false.

boolean


isDisabled

Checks if element is disabled

Parameters

retryInterval number

Retry Interval in milliseconds (defaults to global settings).


retryTimeout number

Retry Timeout in milliseconds (defaults to global settings).


Returns

true if disabled, else false.

boolean


isDraggable

Checks if element is draggable .

Parameters

retryInterval number

Retry Interval in milliseconds (defaults to global settings).


retryTimeout number

Retry Timeout in milliseconds (defaults to global settings).


Returns

true if disabled, else false.

boolean


attribute

Read attribute value of the element found.

Examples
link('google').attribute('alt')
Parameters

name string

Returns

value of attribute

string


elements

DOM element getter. Implicitly wait for the element to appears with timeout of 10 seconds.

Examples
// To loop over all the elements
let elements = await $('a').elements();
for (element of elements) {
   console.log(await element.text());
}
textBox('username').value()
(await textBox('username').elements())[0].value() # same as above
$('.class').text()
(await $('.class').elements())[0].text() # same as above
let element = await $('a').element(0);
console.log(await element.text());
Parameters

retryInterval number

Retry Interval in milliseconds (defaults to global settings).


retryTimeout number

Retry Timeout in milliseconds (defaults to global settings).


Returns

Array of all elements matching the selector.

Array.<Element>


element

DOM element getter. Implicitly wait for the element to appears with timeout of 10 seconds.

Parameters

index number

Zero-based index of element to return


retryInterval number

Retry Interval in milliseconds (defaults to global settings).


retryTimeout number

Retry Timeout in milliseconds (defaults to global settings).


Returns

First element that matches the selector.

Element