Namespace: action

action

Implements WebDriver Actions API: a low-level interface for providing virtualised device input to the web browser.

Source:

Classes

Action
Chain
Key
Mouse
PointerParameters
Sequence

Members

(static) InputState

Possible kinds of |InputState| for supported input sources.

Source:

(static) inputStateMap

Input state associated with current session. This is a map between input ID and the device state for that input source, with one entry for each active input source.

Initialized in listener.js.

Source:

(static) inputsToCancel

List of action.Action associated with current session. Used to manage dispatching events when resetting the state of the input sources. Reset operations are assumed to be idempotent.

Initialized in listener.js

Source:

(static) PointerOrigin

Represents possible values for a pointer-move origin.

Source:

(static) PointerType

Represents possible subtypes for a pointer input source.

Source:

Methods

(static) Chain()

Functionality for (single finger) action chains.

Source:

(static) computePointerDestination(a, inputState, centeropt) → {Map.<string, number>}

Compute viewport coordinates of pointer target based on given origin.

Parameters:
Name Type Attributes Description
a action.Action

Action that specifies pointer origin and x and y coordinates of target.

inputState action.InputState

Input state that specifies current x and y coordinates of pointer.

center Map.<string, number> <optional>

Object representing x and y coordinates of an element center-point. This is only used if |a.origin| is a web element reference.

Source:
Returns:

x and y coordinates of pointer destination.

Type
Map.<string, number>

(static) computeTickDuration(tickActions) → {number}

Compute tick duration in milliseconds for a collection of actions.

Parameters:
Name Type Description
tickActions Array.<action.Action>

List of actions for one tick.

Source:
Returns:

Longest action duration in |tickActions| if any, or 0.

Type
number

(static) dispatch(chain, window) → {Promise}

Dispatch a chain of actions over |chain.length| ticks.

This is done by creating a Promise for each tick that resolves once all the Promises for individual tick-actions are resolved. The next tick's actions are not dispatched until the Promise for the current tick is resolved.

Parameters:
Name Type Description
chain action.Chain

Actions grouped by tick; each element in |chain| is a sequence of actions for one tick.

window WindowProxy

Current window global.

Source:
Returns:

Promise for dispatching all actions in |chain|.

Type
Promise

(static) dispatchTickActions(tickActions, tickDuration, window) → {Promise}

Dispatch sequence of actions for one tick.

This creates a Promise for one tick that resolves once the Promise for each tick-action is resolved, which takes at least |tickDuration| milliseconds. The resolved set of events for each tick is followed by firing of pending DOM events.

Note that the tick-actions are dispatched in order, but they may have different durations and therefore may not end in the same order.

Parameters:
Name Type Description
tickActions Array.<action.Action>

List of actions for one tick.

tickDuration number

Duration in milliseconds of this tick.

window WindowProxy

Current window global.

Source:
Returns:

Promise for dispatching all tick-actions and pending DOM events.

Type
Promise

(static) processPointerAction(id, pointerParams, act)

Adds pointerType attribute to Action act.

Helper function for action.Action.fromJSON.

Parameters:
Name Type Description
id string

Input source ID.

pointerParams action.PointerParams

Input source pointer parameters.

act action.Action

Action to be updated.

Source:
Throws:

If id is already mapped to an action.InputState that is not compatible with act.type or pointerParams.pointerType.

Type
InvalidArgumentError