Input Domain
Methods
- Input.cancelDragging
- Input.dispatchKeyEvent
- Input.dispatchMouseEvent
- Input.dispatchTouchEvent
- Input.setIgnoreInputEvents
- Input.dispatchDragEvent Experimental
- Input.emulateTouchFromMouseEvent Experimental
- Input.imeSetComposition Experimental
- Input.insertText Experimental
- Input.setInterceptDrags Experimental
- Input.synthesizePinchGesture Experimental
- Input.synthesizeScrollGesture Experimental
- Input.synthesizeTapGesture Experimental
Events
- Input.dragIntercepted Experimental
Types
- Input.MouseButton
- Input.TimeSinceEpoch
- Input.TouchPoint
- Input.DragData Experimental
- Input.DragDataItem Experimental
- Input.GestureSourceType Experimental
Methods
Input.dispatchKeyEvent #
Dispatches a key event to the page.
Parameters
type stringType of the key event.
Allowed values: keyDown, keyUp, rawKeyDown, char
modifiersOptional
integerBit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
timestampOptional
Time at which the event occurred.
textOptional
stringText as generated by processing a virtual key code with a keyboard layout. Not needed for
for keyUp and rawKeyDown events (default: "")
unmodifiedTextOptional
stringText that would have been generated by the keyboard if no modifiers were pressed (except for shift). Useful for shortcut (accelerator) key handling (default: "").
keyIdentifierOptional
stringUnique key identifier (e.g., 'U+0041') (default: "").
codeOptional
stringUnique DOM defined string value for each physical key (e.g., 'KeyA') (default: "").
keyOptional
stringUnique DOM defined string value describing the meaning of the key in the context of active modifiers, keyboard layout, etc (e.g., 'AltGr') (default: "").
windowsVirtualKeyCodeOptional
integerWindows virtual key code (default: 0).
nativeVirtualKeyCodeOptional
integerNative virtual key code (default: 0).
autoRepeatOptional
booleanWhether the event was generated from auto repeat (default: false).
isKeypadOptional
booleanWhether the event was generated from the keypad (default: false).
isSystemKeyOptional
booleanWhether the event was a system key event (default: false).
locationOptional
integerWhether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default: 0).
commandsOptional
array[ string ]Editing commands to send with the key event (e.g., 'selectAll') (default: []).
These are related to but not equal the command names used in document.execCommand and NSStandardKeyBindingResponding.
See https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/editing/commands/editor_command_names.h for valid command names.
Input.dispatchMouseEvent #
Dispatches a mouse event to the page.
Parameters
type stringType of the mouse event.
Allowed values: mousePressed, mouseReleased, mouseMoved, mouseWheel
x numberX coordinate of the event relative to the main frame's viewport in CSS pixels.
y numberY coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
modifiersOptional
integerBit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
timestampOptional
Time at which the event occurred.
buttonOptional
Mouse button (default: "none").
buttonsOptional
integerA number indicating which buttons are pressed on the mouse when a mouse event is triggered. Left=1, Right=2, Middle=4, Back=8, Forward=16, None=0.
clickCountOptional
integerNumber of times the mouse button was clicked (default: 0).
forceOptional
numberThe normalized pressure, which has a range of [0,1] (default: 0).
tangentialPressureOptional
numberThe normalized tangential pressure, which has a range of [-1,1] (default: 0).
tiltXOptional
numberThe plane angle between the Y-Z plane and the plane containing both the stylus axis and the Y axis, in degrees of the range [-90,90], a positive tiltX is to the right (default: 0).
tiltYOptional
numberThe plane angle between the X-Z plane and the plane containing both the stylus axis and the X axis, in degrees of the range [-90,90], a positive tiltY is towards the user (default: 0).
twistOptional
integerThe clockwise rotation of a pen stylus around its own major axis, in degrees in the range [0,359] (default: 0).
deltaXOptional
numberX delta in CSS pixels for mouse wheel event (default: 0).
deltaYOptional
numberY delta in CSS pixels for mouse wheel event (default: 0).
pointerTypeOptional
stringPointer type (default: "mouse").
Allowed values: mouse, pen
Input.dispatchTouchEvent #
Dispatches a touch event to the page.
Parameters
type stringType of the touch event. TouchEnd and TouchCancel must not contain any touch points, while TouchStart and TouchMove must contains at least one.
Allowed values: touchStart, touchEnd, touchMove, touchCancel
touchPoints array[ TouchPoint ]Active touch points on the touch device. One event per any changed point (compared to previous touch event in a sequence) is generated, emulating pressing/moving/releasing points one by one.
modifiersOptional
integerBit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
timestampOptional
Time at which the event occurred.
Input.setIgnoreInputEvents #
Ignores input events (useful while auditing page).
Parameters
ignore booleanIgnores input events processing when set to true.
Input.dispatchDragEvent Experimental#
Dispatches a drag event into the page.
Parameters
type stringType of the drag event.
Allowed values: dragEnter, dragOver, drop, dragCancel
x numberX coordinate of the event relative to the main frame's viewport in CSS pixels.
y numberY coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
data modifiersOptional
integerBit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
Input.emulateTouchFromMouseEvent Experimental#
Emulates touch event from the mouse event parameters.
Parameters
type stringType of the mouse event.
Allowed values: mousePressed, mouseReleased, mouseMoved, mouseWheel
x integerX coordinate of the mouse pointer in DIP.
y integerY coordinate of the mouse pointer in DIP.
button Mouse button. Only "none", "left", "right" are supported.
timestampOptional
Time at which the event occurred (default: current time).
deltaXOptional
numberX delta in DIP for mouse wheel event (default: 0).
deltaYOptional
numberY delta in DIP for mouse wheel event (default: 0).
modifiersOptional
integerBit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
clickCountOptional
integerNumber of times the mouse button was clicked (default: 0).
Input.imeSetComposition Experimental#
This method sets the current candidate text for IME. Use imeCommitComposition to commit the final text. Use imeSetComposition with empty string as text to cancel composition.
Parameters
text stringThe text to insert
selectionStart integerselection start
selectionEnd integerselection end
replacementStartOptional
integerreplacement start
replacementEndOptional
integerreplacement end
Input.insertText Experimental#
This method emulates inserting text that doesn't come from a key press, for example an emoji keyboard or an IME.
Parameters
text stringThe text to insert.
Input.setInterceptDrags Experimental#
Prevents default drag and drop behavior and instead emits Input.dragIntercepted events.
Drag and drop behavior can be directly controlled via Input.dispatchDragEvent.
Parameters
enabled booleanInput.synthesizePinchGesture Experimental#
Synthesizes a pinch gesture over a time period by issuing appropriate touch events.
Parameters
x numberX coordinate of the start of the gesture in CSS pixels.
y numberY coordinate of the start of the gesture in CSS pixels.
scaleFactor numberRelative scale factor after zooming (>1.0 zooms in, <1.0 zooms out).
relativeSpeedOptional
integerRelative pointer speed in pixels per second (default: 800).
gestureSourceTypeOptional
Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type).
Input.synthesizeScrollGesture Experimental#
Synthesizes a scroll gesture over a time period by issuing appropriate touch events.
Parameters
x numberX coordinate of the start of the gesture in CSS pixels.
y numberY coordinate of the start of the gesture in CSS pixels.
xDistanceOptional
numberThe distance to scroll along the X axis (positive to scroll left).
yDistanceOptional
numberThe distance to scroll along the Y axis (positive to scroll up).
xOverscrollOptional
numberThe number of additional pixels to scroll back along the X axis, in addition to the given distance.
yOverscrollOptional
numberThe number of additional pixels to scroll back along the Y axis, in addition to the given distance.
preventFlingOptional
booleanPrevent fling (default: true).
speedOptional
integerSwipe speed in pixels per second (default: 800).
gestureSourceTypeOptional
Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type).
repeatCountOptional
integerThe number of times to repeat the gesture (default: 0).
repeatDelayMsOptional
integerThe number of milliseconds delay between each repeat. (default: 250).
interactionMarkerNameOptional
stringThe name of the interaction markers to generate, if not empty (default: "").
Input.synthesizeTapGesture Experimental#
Synthesizes a tap gesture over a time period by issuing appropriate touch events.
Parameters
x numberX coordinate of the start of the gesture in CSS pixels.
y numberY coordinate of the start of the gesture in CSS pixels.
durationOptional
integerDuration between touchdown and touchup events in ms (default: 50).
tapCountOptional
integerNumber of times to perform the tap (e.g. 2 for double tap, default: 1).
gestureSourceTypeOptional
Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type).
Events
Types
Input.TouchPoint #
Type: object
Properties
x numberX coordinate of the event relative to the main frame's viewport in CSS pixels.
y numberY coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
radiusXOptional
numberX radius of the touch area (default: 1.0).
radiusYOptional
numberY radius of the touch area (default: 1.0).
rotationAngleOptional
numberRotation angle (default: 0.0).
forceOptional
numberForce (default: 1.0).
tangentialPressureOptional
numberThe normalized tangential pressure, which has a range of [-1,1] (default: 0).
tiltXOptional
numberThe plane angle between the Y-Z plane and the plane containing both the stylus axis and the Y axis, in degrees of the range [-90,90], a positive tiltX is to the right (default: 0)
tiltYOptional
numberThe plane angle between the X-Z plane and the plane containing both the stylus axis and the X axis, in degrees of the range [-90,90], a positive tiltY is towards the user (default: 0).
twistOptional
integerThe clockwise rotation of a pen stylus around its own major axis, in degrees in the range [0,359] (default: 0).
idOptional
numberIdentifier used to track touch sources between events, must be unique within an event.
Input.DragData Experimental#
Type: object
Properties
items array[ DragDataItem ]filesOptional
array[ string ]List of filenames that should be included when dropping
dragOperationsMask integerBit field representing allowed drag operations. Copy = 1, Link = 2, Move = 16
Input.DragDataItem Experimental#
Type: object
Properties
mimeType stringMime type of the dragged data.
data stringDepending of the value of mimeType, it contains the dragged link,
text, HTML markup or any other data.
titleOptional
stringTitle associated with a link. Only valid when mimeType == "text/uri-list".
baseURLOptional
stringStores the base URL for the contained markup. Only valid when mimeType
== "text/html".