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.
Build()
Returns:
A self-reference.
Click¶
Clicks the mouse on the specified element. If no element is specified clicks the mouse at the last known mouse coordinates.
Click(el)
Parameters:
Name | Type | Description |
---|---|---|
el | WebElement | The element on which to click. Optional. |
Returns:
A self-reference.
ClickAndHold¶
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.
ClickAndHold(el)
Parameters:
Name | Type | Description |
---|---|---|
el | WebElement | The element on which to click and hold. Optional. |
Returns:
A self-reference.
ContextClick¶
Right-clicks the mouse on the specified element. If no element is specified right-clicks the mouse at the last known mouse coordinates.
ContextClick(el)
Parameters:
Name | Type | Description |
---|---|---|
el | WebElement | The element on which to right-click. Optional. |
Returns:
A self-reference.
DoubleClick¶
Double-clicks the mouse on the specified element. If no element is specified double-clicks the mouse at the last known mouse coordinates.
DoubleClick(el)
Parameters:
Name | Type | Description |
---|---|---|
el | WebElement | The element on which to double-click. Optional. |
Returns:
A self-reference.
DragAndDrop¶
Performs a drag-and-drop operation from one element to another.
DragAndDrop(source, target)
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¶
Performs a drag-and-drop operation on one element to a specified offset.
DragAndDropToOffset(source, offsetX, offsetY)
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¶
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.
KeyDown(theKey, el)
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¶
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.
KeyUp(theKey, el)
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¶
Moves the mouse to the specified offset of the last known mouse coordinates.
MoveByOffset(offsetX, offsetY)
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¶
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.
MoveToElement(el, offsetX, offsetY)
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.
Perform()
Release¶
Releases the mouse button on the specified element. If no element is specified releases the mouse button at the last known mouse coordinates.
Release(el)
Parameters:
Name | Type | Description |
---|---|---|
el | WebElement | The element on which to release the button. Optional. |
Returns:
A self-reference.
SendKeys¶
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.
SendKeys(keysToSend, el)
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.