Chrome DevTools Protocol

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
integer

Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).

timestamp
number

Time at which the event occurred. Measured in UTC time in seconds since January 1, 1970 (default: current time).

text
string

Text as generated by processing a virtual key code with a keyboard layout. Not needed for for <code>keyUp</code> and <code>rawKeyDown</code> events (default: "")

unmodifiedText
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
string

Unique key identifier (e.g., 'U+0041') (default: "").

code
string

Unique DOM defined string value for each physical key (e.g., 'KeyA') (default: "").

key
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
integer

Windows virtual key code (default: 0).

nativeVirtualKeyCode
integer

Native virtual key code (default: 0).

autoRepeat
boolean

Whether the event was generated from auto repeat (default: false).

isKeypad
boolean

Whether the event was generated from the keypad (default: false).

isSystemKey
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
integer

Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).

timestamp
number

Time at which the event occurred. Measured in UTC time in seconds since January 1, 1970 (default: current time).

button
string

Mouse button (default: "none").

Allowed Values: none, left, middle, right
clickCount
integer

Number of times the mouse button was clicked (default: 0).