Methods
Input.dispatchKeyEvent #
Dispatches a key event to the page.
Parameters
type
string
Type of the key event.
Allowed values: keyDown
, keyUp
, rawKeyDown
, char
modifiers
Optional
integer
Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
timestamp
Optional
number
Time at which the event occurred. Measured in UTC time in seconds since January 1, 1970 (default: current time).
text
Optional
string
Text as generated by processing a virtual key code with a keyboard layout. Not needed for for keyUp and rawKeyDown events (default: "")
unmodifiedText
Optional
string
Text that would have been generated by the keyboard if no modifiers were pressed (except for shift). Useful for shortcut (accelerator) key handling (default: "").
keyIdentifier
Optional
string
Unique key identifier (e.g., 'U+0041') (default: "").
code
Optional
string
Unique DOM defined string value for each physical key (e.g., 'KeyA') (default: "").
key
Optional
string
Unique DOM defined string value describing the meaning of the key in the context of active modifiers, keyboard layout, etc (e.g., 'AltGr') (default: "").
windowsVirtualKeyCode
Optional
integer
Windows virtual key code (default: 0).
nativeVirtualKeyCode
Optional
integer
Native virtual key code (default: 0).
autoRepeat
Optional
boolean
Whether the event was generated from auto repeat (default: false).
isKeypad
Optional
boolean
Whether the event was generated from the keypad (default: false).
isSystemKey
Optional
boolean
Whether the event was a system key event (default: false).
Input.dispatchMouseEvent #
Dispatches a mouse event to the page.
Parameters
type
string
Type of the mouse event.
Allowed values: mousePressed
, mouseReleased
, mouseMoved
x
integer
X coordinate of the event relative to the main frame's viewport.
y
integer
Y coordinate of the event relative to the main frame's viewport. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
modifiers
Optional
integer
Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
timestamp
Optional
number
Time at which the event occurred. Measured in UTC time in seconds since January 1, 1970 (default: current time).
button
Optional
string
Mouse button (default: "none").
Allowed values: none
, left
, middle
, right
clickCount
Optional
integer
Number of times the mouse button was clicked (default: 0).