Actions

This is a JavaScript wrapper for Actions of Selenium .NET library.

Action Summary

Action Description
Build Builds the sequence of actions.
Click Clicks the mouse on the specified element.
ClickAndHold Clicks and holds the mouse button down on the specified element.
ContextClick Right-clicks the mouse on the specified element.
DoubleClick Double-clicks the mouse on the specified element.
DragAndDrop Performs a drag-and-drop operation from one element to another.
DragAndDropToOffset Performs a drag-and-drop operation on one element to a specified offset.
KeyDown Sends a modifier key down message to the specified element in the browser.
KeyUp Sends a modifier key up message to the specified element in the browser.
MoveByOffset Moves the mouse to the specified offset of the last known mouse coordinates.
MoveToElement Moves the mouse to the specified offset of the top-left corner of the specified element.
Perform Performs the currently built action.
Release Releases the mouse button on the specified element.
SendKeys Sends a sequence of keystrokes to the specified element in the browser.

Action Detail

Build()

Builds the sequence of actions.

Returns:

A self-reference.

Click(el)

Clicks the mouse on the specified element. If no element is specified clicks the mouse at the last known mouse coordinates.

Parameters:

Name Type Description
el WebElement The element on which to click.
Optional.

Returns:

A self-reference.

ClickAndHold(el)

Clicks and holds the mouse button down on the specified element. If no element is specified clicks and holds the mouse button at the last known mouse coordinates.

Parameters:

Name Type Description
el WebElement The element on which to click and hold.
Optional.

Returns:

A self-reference.

ContextClick(el)

Right-clicks the mouse on the specified element. If no element is specified right-clicks the mouse at the last known mouse coordinates.

Parameters:

Name Type Description
el WebElement The element on which to right-click.
Optional.

Returns:

A self-reference.

DoubleClick(el)

Double-clicks the mouse on the specified element. If no element is specified double-clicks the mouse at the last known mouse coordinates.

Parameters:

Name Type Description
el WebElement The element on which to double-click.
Optional.

Returns:

A self-reference.

DragAndDrop(source, target)

Performs a drag-and-drop operation from one element to another.

Parameters:

Name Type Description
source WebElement The element on which the drag operation is started.
target WebElement The element on which the drop is performed.

Returns:

A self-reference.

DragAndDropToOffset(source, offsetX, offsetY)

Performs a drag-and-drop operation on one element to a specified offset.

Parameters:

Name Type Description
source WebElement The element on which the drag operation is started.
offsetX number The horizontal offset to which to move the mouse.
offsetY number The vertical offset to which to move the mouse.

Returns:

A self-reference.

KeyDown(theKey, el)

Sends a modifier key down message to the specified element in the browser. If no element is specified sends a modifier key down message to the browser.

Parameters:

Name Type Description
theKey string The key to be sent. Accepts "Shift", "Control" and "Alt".
el WebElement The element to which to send the key command.
Optional.

Returns:

A self-reference.

KeyUp(theKey, el)

Sends a modifier key up message to the specified element in the browser. If no element is specified sends a modifier key up message to the browser.

Parameters:

Name Type Description
theKey string The key to be sent. Accepts "Shift", "Control" and "Alt".
el WebElement The element to which to send the key command.
Optional.

Returns:

A self-reference.

MoveByOffset(offsetX, offsetY)

Moves the mouse to the specified offset of the last known mouse coordinates.

Parameters:

Name Type Description
offsetX number The horizontal offset to which to move the mouse.
offsetY number The vertical offset to which to move the mouse.

Returns:

A self-reference.

MoveToElement(el, offsetX, offsetY)

Moves the mouse to the specified offset of the top-left corner of the specified element. If offset is not specified moves the mouse to the specified element.

Parameters:

Name Type Description
el WebElement The element to which to move the mouse.
offsetX number The horizontal offset to which to move the mouse.
Optional.
offsetY number The vertical offset to which to move the mouse.
Optional.

Returns:

A self-reference.

Perform()

Performs the currently built action.

Release(el)

Releases the mouse button on the specified element. If no element is specified releases the mouse button at the last known mouse coordinates.

Parameters:

Name Type Description
el WebElement The element on which to release the button.
Optional.

Returns:

A self-reference.

SendKeys(keysToSend, el)

Sends a sequence of keystrokes to the specified element in the browser. If no element is specified sends a sequence of keystrokes to the browser.

Parameters:

Name Type Description
keysToSend string The keystrokes to send to the browser.
el WebElement The element to which to send the keystrokes.
Optional.

Returns:

A self-reference.