Actions
session.performActions(actionSequences)
Sends virtualised device input to the web browser like keyboard or pointer events in a series of actions.
PARAMETERS
actionSequences: ActionSequence[] - Array with actions to be performed on the current page
RETURNS
Promise<void>
EXAMPLES
await session.performActions([
{
type: 'none',
id: 'none_id',
actions: [{ type: 'pause', duration: 0 }]
},
{
type: 'pointer',
id: 'click on b field',
actions: [
{ type: 'pause', duration: 0 },
{ type: 'pointerMove', x: 118, y: 121 },
{ type: 'pointerDown', button: 0 },
{ type: 'pointerUp', button: 0 }
]
}
]);await session.performActions([
{
type: 'key',
id: 'type in 15',
actions: [
{ type: 'pause', duration: 100 },
{ type: 'keyDown', value: '1' },
{ type: 'keyUp', value: '1' },
{ type: 'keyDown', value: '5' },
{ type: 'keyUp', value: '5' }
]
}
]);await session.performActions([
{
type: 'pointer',
id: 'click on add button',
actions: [
{ type: 'pointerMove', x: 1, y: 1, origin: await session.findElement('css selector', '#add') },
{ type: 'pointerDown', button: 0 },
{ type: 'pointerUp', button: 0 }
],
parameters: {
pointerType: 'mouse'
}
}
]);await session.performActions([
{
type: 'key',
id: 'key id',
actions: [
{ type: 'keyDown', value: 'a' },
{ type: 'keyUp', value: 'a' },
{ type: 'keyDown', value: 'b' },
{ type: 'keyUp', value: 'b' },
{ type: 'keyDown', value: Key.LEFT },
{ type: 'keyUp', value: Key.LEFT },
{ type: 'keyDown', value: Key.DELETE },
{ type: 'keyUp', value: Key.DELETE }
]
}
]);SEE ALSO
session.releaseActions()
Release all the keys and pointer buttons that are currently depressed
RETURNS
Promise<void>
EXAMPLES
await session.performActions([
{
type: 'key',
id: 'key id',
actions: [{ type: 'keyDown', value: 'a' }]
}
]);
await session.releaseActions();
// Now 'a' key was pressedSEE ALSO
ActionSequence
POSSIBLE VALUES
NullActionSequence
PROPERTIES
type:'none'id: stringactions: PauseAction[]
PauseAction
PROPERTIES
type:'pause'duration: number
KeyActionSequence
PROPERTIES
type:'key'id: stringactions: KeyAction[]
KeyAction
POSSIBLE VALUES
KeyDownAction
PROPERTIES
type:'keyDown'value: string
KeyUpAction
PROPERTIES
type:'keyUp'value: string
PointerActionSequence
PROPERTIES
type:'pointer'id: stringactions: PointerAction[]parameters?: PointerParameters
PointerAction
POSSIBLE VALUES
PointerMoveAction
PROPERTIES
type:'pointerMove'x: numbery: numberduration?: numberorigin: Element |'pointer'|'viewport'
PointerUpAction
PROPERTIES
type:'pointerUp'button: number
PointerDownAction
PROPERTIES
type:'pointerDown'button: number
PointerParameters
PROPERTIES
pointerType:'mouse'|'pen'|'touch'
NullAction
PROPERTIES
type:'pause'duration: number
Key
POSSIBLE VALUES
NULLCANCELHELPBACKSPACETABCLEARRETURNENTERSHIFTCONTROLALTPAUSEESCAPESPACEPAGE_UPPAGE_DOWNENDHOMELEFTUPRIGHTDOWNINSERTDELETESEMICOLONEQUALSNUMPAD0NUMPAD1NUMPAD2NUMPAD3NUMPAD4NUMPAD5NUMPAD6NUMPAD7NUMPAD8NUMPAD9MULTIPLYADDSEPARATORSUBTRACTDECIMALDIVIDEF1F2F3F4F5F6F7F8F9F10F11F12METAZENKAKUHANKAKUR_SHIFTR_CONTROLR_ALTR_METAR_PAGEUPR_PAGEDOWNR_ENDR_HOMER_ARROWLEFTR_ARROWUPR_ARROWRIGHTR_ARROWDOWNR_INSERTR_DELETE
Last updated
Was this helpful?