Input Domain
Methods
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
keyUp
andrawKeyDown
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).
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).
dispatchTouchEvent#
Dispatches a touch event to the page.
Parameters
- type
- string Type of the touch event. Allowed values: touchStart, touchEnd, touchMove.
- touchPoints
- array [ TouchPoint ] Touch points.
- 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).
emulateTouchFromMouseEvent#
Emulates touch event from the mouse event parameters.
Parameters
- type
- string Type of the mouse event. Allowed values: mousePressed, mouseReleased, mouseMoved, mouseWheel.
- x
- integer X coordinate of the mouse pointer in DIP.
- y
- integer Y coordinate of the mouse pointer in DIP.
- timestamp
- number Time at which the event occurred. Measured in UTC time in seconds since January 1, 1970.
- button
- string Mouse button. Allowed values: none, left, middle, right.
- deltaX
- number X delta in DIP for mouse wheel event (default: 0).
- deltaY
- number Y delta in DIP for mouse wheel event (default: 0).
- modifiers
- integer Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
- clickCount
- integer Number of times the mouse button was clicked (default: 0).
synthesizePinchGesture#
Synthesizes a pinch gesture over a time period by issuing appropriate touch events.
Parameters
- x
- integer X coordinate of the start of the gesture in CSS pixels.
- y
- integer Y coordinate of the start of the gesture in CSS pixels.
- scaleFactor
- number Relative scale factor after zooming (>1.0 zooms in, <1.0 zooms out).
- relativeSpeed
- integer Relative pointer speed in pixels per second (default: 800).
- gestureSourceType
- GestureSourceType Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type).
synthesizeScrollGesture#
Synthesizes a scroll gesture over a time period by issuing appropriate touch events.
Parameters
- x
- integer X coordinate of the start of the gesture in CSS pixels.
- y
- integer Y coordinate of the start of the gesture in CSS pixels.
- xDistance
- integer The distance to scroll along the X axis (positive to scroll left).
- yDistance
- integer The distance to scroll along the Y axis (positive to scroll up).
- xOverscroll
- integer The number of additional pixels to scroll back along the X axis, in addition to the given distance.
- yOverscroll
- integer The number of additional pixels to scroll back along the Y axis, in addition to the given distance.
- preventFling
- boolean Prevent fling (default: true).
- speed
- integer Swipe speed in pixels per second (default: 800).
- gestureSourceType
- GestureSourceType Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type).
- repeatCount
- integer The number of times to repeat the gesture (default: 0).
- repeatDelayMs
- integer The number of milliseconds delay between each repeat. (default: 250).
- interactionMarkerName
- string The name of the interaction markers to generate, if not empty (default: "").
synthesizeTapGesture#
Synthesizes a tap gesture over a time period by issuing appropriate touch events.
Parameters
- x
- integer X coordinate of the start of the gesture in CSS pixels.
- y
- integer Y coordinate of the start of the gesture in CSS pixels.
- duration
- integer Duration between touchdown and touchup events in ms (default: 50).
- tapCount
- integer Number of times to perform the tap (e.g. 2 for double tap, default: 1).
- gestureSourceType
- GestureSourceType Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type).
Types
TouchPoint#
Type: object
Properties
- state
- string State of the touch point. Allowed values: touchPressed, touchReleased, touchMoved, touchStationary, touchCancelled.
- 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.
- radiusX
- integer X radius of the touch area (default: 1).
- radiusY
- integer Y radius of the touch area (default: 1).
- rotationAngle
- number Rotation angle (default: 0.0).
- force
- number Force (default: 1.0).
- id
- number Identifier used to track touch sources between events, must be unique within an event.