# Class Actions

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

#####
Index

### Constructors

constructor

### Methods

clear
click
contextClick
doubleClick
dragAndDrop
keyDown
keyUp
keyboard
mouse
move
pause
perform
press
release
sendKeys

## Constructors

### constructor

- new Actions(executor, options?): Actions

- #### Parameters

  - ##### executor: 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?): 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?): 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?): 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, to?): 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: null | WebElement | {
    x?: string | number;
    y?: string | number;
    }

  #### Returns Actions

### keyDown

- keyDown(key): 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.

### keyUp

- keyUp(key): Actions

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

### keyboard

- keyboard(): Keyboard

- #### Returns Keyboard

### mouse

- mouse(): Pointer

- #### Returns Pointer

### move

- move(direction): 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 ./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

  - ##### direction: IDirection

  #### Returns Actions

### pause

- pause(duration?, ...devices): 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?): 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?): 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): 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