Class for defining sequences of complex user interactions. Each sequence will not be executed until #perform is called.

Example:

new Actions(driver).
keyDown(Key.SHIFT).
click(element1).
click(element2).
dragAndDrop(element3, element4).
keyUp(Key.SHIFT).
perform();

Hierarchy

  • Actions

Constructors

  • Parameters

    • executor: Executor
    • Optional options: {
          async: boolean;
          bridge: boolean;
      } | {
          async: boolean;
      } | {
          bridge: boolean;
      }

    Returns Actions

Methods

  • Executes this action sequence.

    Returns Promise<void>

    A promise that will be resolved once this sequence has completed.

  • Short-hand for performing a simple left-click (down/up) with the mouse.

    Parameters

    • Optional element: WebElement

      If specified, the mouse will first be moved to the center of the element before performing the click.

    Returns Actions

    a self reference.

  • Short-hand for performing a simple right-click (down/up) with the mouse.

    Parameters

    • Optional element: WebElement

      If specified, the mouse will first be moved to the center of the element before performing the click.

    Returns Actions

    a self reference.

  • Short-hand for performing a double left-click with the mouse.

    Parameters

    • Optional element: WebElement

      If specified, the mouse will first be moved to the center of the element before performing the click.

    Returns Actions

    a self reference.

  • Convenience function for performing a 'drag and drop' manuever. The target element may be moved to the location of another element, or by an offset (in pixels).

    Parameters

    • from: WebElement
    • Optional to: null | WebElement | {
          x?: string | number;
          y?: string | number;
      }

    Returns Actions

  • Performs a modifier key press. The modifier key is not released until #keyUp or #sendKeys is called. The key press will be targetted at the currently focused element.

    Parameters

    • key: string

      The modifier key to push. Must be one of {ALT, CONTROL, SHIFT, COMMAND, META}.

    Returns Actions

    A self reference.

    Throws

    If the key is not a valid modifier key.

  • Performs a modifier key release. The release is targetted at the currently focused element.

    Parameters

    • key: string

      The modifier key to release. Must be one of {ALT, CONTROL, SHIFT, COMMAND, META}.

    Returns Actions

    A self reference.

    Throws

    If the key is not a valid modifier key.

  • Inserts an action for moving the mouse x and y pixels relative to the specified origin. The origin may be defined as the mouse's ./input.Origin.POINTER current position, the ./input.Origin.VIEWPORT viewport, or the center of a specific ./webdriver.WebElement WebElement.

    You may adjust how long the remote end should take, in milliseconds, to perform the move using the duration parameter (defaults to 100 ms). The number of incremental move events generated over this duration is an implementation detail for the remote end.

    Defaults to moving the mouse to the top-left corner of the viewport over 100ms.

    Parameters

    Returns Actions

  • Executes this action sequence.

    Returns Promise<void>

    A promise that will be resolved once this sequence has completed.

  • Inserts an action to press a mouse button at the mouse's current location. Defaults to LEFT.

    Parameters

    Returns Actions

  • Inserts an action to release a mouse button at the mouse's current location. Defaults to LEFT.

    Parameters

    Returns Actions

  • Simulates typing multiple keys. Each modifier key encountered in the sequence will not be released until it is encountered again. All key events will be targeted at the currently focused element.

    Parameters

    • Rest ...var_args: (string | Promise<string>)[]

      The keys to type.

    Returns Actions

    A self reference.

    Throws

    If the key is not a valid modifier key.

Generated using TypeDoc