action module

class action()

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

action.Action
action.Chain
action.InputState

Possible kinds of |InputState| for supported input sources.

action.Key
action.Mouse
action.PointerOrigin

Represents possible values for a pointer-move origin.

action.PointerParameters
action.PointerType

Represents possible subtypes for a pointer input source.

action.Sequence
action.computePointerDestination(a, inputState, center)

Compute viewport coordinates of pointer target based on given origin.

Arguments:
  • 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.
Returns:

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

action.computeTickDuration(tickActions)

Compute tick duration in milliseconds for a collection of actions.

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

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

action.dispatch(chain, win, specCompatPointerOrigin)

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.

Arguments:
  • 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 https://bugzilla.mozilla.org/show_bug.cgi?id=1429338.
Returns:

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.

Arguments:
  • tickActions (Array.<action.Action>) – List of actions for one tick.
  • tickDuration (number) – Duration in milliseconds of this tick.
  • win (WindowProxy) – Current window global.
Returns:

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

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

action.inputsToCancel

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.

Initialized in listener.js

action.processPointerAction(id, pointerParams, act)

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

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

Arguments:
  • id (string) – Input source ID.
  • pointerParams (action.PointerParams) – Input source pointer parameters.
  • act (action.Action) – Action to be updated.
Throws:

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

action.specCompatPointerOrigin

Flag for WebDriver spec conforming pointer origin calculation.