Skip to main content

sdk.automation.press

Home > @matterway/sdk > Automation > press

Automation.press() function

Simulates pressing a key, or a combination of keys.

Signature:

export declare function press(ctx: Context, keys: KeyInput[], options?: PressKeyOptions): Promise<void>;

Parameters

ParameterTypeDescription
ctxContextContext object
keysKeyInput[]Name of key to press, such as ArrowLeft. for a list of all key names.
optionsPressKeyOptions(Optional) Options for key press and pupeeteer keyboard press: interval, times, delay, text.

Returns:

Promise<void>

Example 1

await press(ctx, [key, ...modifiers], options);

Example 2

await press(ctx, ['a','Control']); // Select all

Example 3

await press(ctx, ['Backspace'], {timeBetweenPresses: 100, times: 5, pressDuration: 200});