action module

class action()

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


Possible kinds of |InputState| for supported input sources.


Represents possible values for a pointer-move origin.


Represents possible subtypes for a pointer input source.

action.computePointerDestination(a, inputState, center)

Compute viewport coordinates of pointer target based on given origin.

  • 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.

  • number> center (Map.<string,) – Object representing x and y coordinates of an element center-point. This is only used if |a.origin| is a web element reference.


Map.<string, number> – x and y coordinates of pointer destination.


Compute tick duration in milliseconds for a collection of actions.

  • tickActions (Array.<action.Action>) – List of actions for one tick.


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

action.dispatch(chain, win, specCompatPointerOrigin=true)

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.

  • chain (action.Chain) – Actions grouped by tick; each element in |chain| is a sequence of actions for one tick.

  • win (WindowProxy) – Current window global.

  • specCompatPointerOrigin (boolean) – specCompatPointerOrigin Flag to turn off the WebDriver spec conforming pointer origin calculation. It has to be kept until all Selenium bindings can successfully handle the WebDriver spec conforming Pointer Origin calculation. See


Promise – Promise for dispatching all actions in |chain|.

action.dispatchTickActions(tickActions, tickDuration, win)

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.

  • tickActions (Array.<action.Action>) – List of actions for one tick.

  • tickDuration (number) – Duration in milliseconds of this tick.

  • win (WindowProxy) – Current window global.


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


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.


List of {@link 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.

action.processPointerAction(id, pointerParams, act)

Adds <var>pointerType</var> attribute to Action <var>act</var>.

Helper function for {@link action.Action.fromJSON}.

  • id (string) – Input source ID.

  • pointerParams (action.PointerParams) – Input source pointer parameters.

  • act (action.Action) – Action to be updated.


InvalidArgumentError – If <var>id</var> is already mapped to an {@link action.InputState} that is not compatible with <code>act.type</code> or <code>pointerParams.pointerType</code>.


Flag for WebDriver spec conforming pointer origin calculation.