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

Example:

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

### Hierarchy

- Actions

## Index

### Constructors

- constructor

### Methods

- clear
- click
- contextClick
- doubleClick
- dragAndDrop
- keyDown
- keyUp
- keyboard
- mouse
- mouseDown
- mouseMove
- mouseUp
- move
- pause
- perform
- press
- release
- sendKeys

## Constructors

### constructor

- new Actions(executor: <internal>.Executor, options?: { async: boolean; bridge: boolean } | { async: boolean } | { bridge: boolean }): Actions

- #### Parameters

  - ##### executor: <internal>.Executor

  - ##### Optional options: { async: boolean; bridge: boolean } | { async: boolean } | { bridge: boolean }

  #### Returns Actions

## Methods

### clear

- clear(): Promise<void>

- Executes this action sequence.

  #### Returns Promise<void>

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

### click

- click(element?: WebElement): Actions

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

### contextClick

- contextClick(element?: WebElement): Actions

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

### doubleClick

- doubleClick(element?: WebElement): Actions

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

### dragAndDrop

- dragAndDrop(from: WebElement, to?: WebElement | { x?: string | number; y?: string | number }): Actions

- 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: WebElement | { x?: string | number; y?: string | number }

  #### Returns Actions

### keyDown

- keyDown(key: string): Actions

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

  throws

    {Error} If the key is not a valid modifier key.

  #### Parameters

  - ##### key: string

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

  #### Returns Actions

  A self reference.

### keyUp

- keyUp(key: string): Actions

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

  throws

    {Error} If the key is not a valid modifier key.

  #### Parameters

  - ##### key: string

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

  #### Returns Actions

  A self reference.

### keyboard

- keyboard(): Keyboard

- #### Returns Keyboard

### mouse

- mouse(): Pointer

- #### Returns Pointer

### mouseDown

- mouseDown(opt_elementOrButton?: string | WebElement, opt_button?: string): Actions

- Presses a mouse button. The mouse button will not be released until {@link #mouseUp} is called, regardless of whether that call is made in this sequence or another. The behavior for out-of-order events (e.g. mouseDown, click) is undefined.

  If an element is provided, the mouse will first be moved to the center of that element. This is equivalent to:

      sequence.mouseMove(element).mouseDown()

  Warning: this method currently only supports the left mouse button. See issue 4047.

  #### Parameters

  - ##### Optional opt_elementOrButton: string | WebElement

    Either the element to interact with or the button to click with. Defaults to {@link input.Button.LEFT} if neither an element nor button is specified.

  - ##### Optional opt_button: string

    The button to use. Defaults to {@link input.Button.LEFT}. Ignored if a button is provided as the first argument.

  #### Returns Actions

  A self reference.

### mouseMove

- mouseMove(location: WebElement | ILocation, opt_offset?: ILocation): Actions

- Moves the mouse. The location to move to may be specified in terms of the mouse's current location, an offset relative to the top-left corner of an element, or an element (in which case the middle of the element is used).

  #### Parameters

  - ##### location: WebElement | ILocation

  - ##### Optional opt_offset: ILocation

  #### Returns Actions

  A self reference.

### mouseUp

- mouseUp(opt_elementOrButton?: string | WebElement, opt_button?: string): Actions

- Releases a mouse button. Behavior is undefined for calling this function without a previous call to {@link #mouseDown}.

  If an element is provided, the mouse will first be moved to the center of that element. This is equivalent to:

      sequence.mouseMove(element).mouseUp()

  Warning: this method currently only supports the left mouse button. See issue 4047.

  #### Parameters

  - ##### Optional opt_elementOrButton: string | WebElement

    Either the element to interact with or the button to click with. Defaults to {@link input.Button.LEFT} if neither an element nor button is specified.

  - ##### Optional opt_button: string

    The button to use. Defaults to {@link input.Button.LEFT}. Ignored if a button is provided as the first argument.

  #### Returns Actions

  A self reference.

### move

- move(direction: IDirection): Actions

- 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 {@linkplain ./input.Origin.POINTER current position}, the {@linkplain ./input.Origin.VIEWPORT viewport}, or the center of a specific {@linkplain ./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

  - ##### direction: IDirection

  #### Returns Actions

### pause

- pause(duration?: number | Device, ...devices: Device[]): Actions

- #### Parameters

  - ##### Optional duration: number | Device

  - ##### Rest ...devices: Device[]

  #### Returns Actions

### perform

- perform(): Promise<void>

- Executes this action sequence.

  #### Returns Promise<void>

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

### press

- press(button?: Button): Actions

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

  #### Parameters

  - ##### Optional button: Button

  #### Returns Actions

### release

- release(button?: Button): Actions

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

  #### Parameters

  - ##### Optional button: Button

  #### Returns Actions

### sendKeys

- sendKeys(...var_args: (string | Promise<string>)[]): 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.

  throws

    {Error} If the key is not a valid modifier key.

  #### Parameters

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

        The keys to type.

  #### Returns Actions

  A self reference.

Generated using TypeDoc