Constructor
new Actions(…inputDevice)
The constructor
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
inputDevice |
InputDevice |
<repeatable> |
Input devices that will be used to carry out
actions. By default, two devices are created:
|
- Source:
Example
// Creating an actions object. This...
var actions = new Actions()
// Is the same as:
var Pointer = Actions.Pointer
var Keyboard = Actions.Keyboard
var actions = new Actions( new Actions.Keyboard('keyboard'), new Actions.Pointer('mouse', Pointer.Type.MOUSE))
// You can also be creative with names
var actions = new Actions.Pointer('da_mouse', Pointer.Type.MOUSE)
Members
(static) Key
Constant returning special KEY characters (enter, etc.) Constant are from the global variable KEY
- Source:
Example
var actions = new Actions()
actions.tick.keyboardDown(Actions.Key.ENTER).keyboardUp(Actions.Key.ENTER)
(static) Keyboard
The Keyboard class constructor
- Source:
(static) Pointer
The Keyboard class constructor
- Source:
tick
As a getter, it will return an object with the right methods depending on what devices were passed when constructing the object. For example running:
var actions = new Actions(new Actions.Keyboard('cucumber'))
Will ensure that tick
will return an object with the properties
cucumberUp
, cucumberDown
and pause
More conventionally, creating the action object like this:
var actions = new Actions()
Will default to two devices, mouse
and keyboard
. So, the object returned
by the tick
getter will return an object with the methods keyboardUp()
, keyboardDown()
,
keyboardPause()
, mouseUp()
, mouseDown()
, mouseCancel()
, mousePause()
- Source:
Methods
compile()
Compiles the stored actions into a compiledActions
object, which is
an object compatible with the webdriver protocol for actions
There is no need to call this method directly, since the driver always tries
to compile()
actions before sending them over.
- Source: