clj-chrome-devtools.commands.input

dispatch-drag-event

(dispatch-drag-event)(dispatch-drag-event {:as params, :keys [type x y data modifiers]})(dispatch-drag-event connection {:as params, :keys [type x y data modifiers]})

Dispatches a drag event into the page.

Parameters map keys:

Key Description
:type Type of the drag event.
:x X coordinate of the event relative to the main frame’s viewport in CSS pixels.
:y Y 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 | null :modifiers | Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0). (optional)

dispatch-key-event

(dispatch-key-event)(dispatch-key-event {:as params, :keys [type modifiers timestamp text unmodified-text key-identifier code key windows-virtual-key-code native-virtual-key-code auto-repeat is-keypad is-system-key location commands]})(dispatch-key-event connection {:as params, :keys [type modifiers timestamp text unmodified-text key-identifier code key windows-virtual-key-code native-virtual-key-code auto-repeat is-keypad is-system-key location commands]})

Dispatches a key event to the page.

Parameters map keys:

Key Description
:type Type of the key event.
:modifiers Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8

(default: 0). (optional) :timestamp | Time at which the event occurred. (optional) :text | Text as generated by processing a virtual key code with a keyboard layout. Not needed for for keyUp and rawKeyDown events (default: "") (optional) :unmodified-text | Text that would have been generated by the keyboard if no modifiers were pressed (except for shift). Useful for shortcut (accelerator) key handling (default: ""). (optional) :key-identifier | Unique key identifier (e.g., ‘U+0041’) (default: ""). (optional) :code | Unique DOM defined string value for each physical key (e.g., ‘KeyA’) (default: ""). (optional) :key | Unique DOM defined string value describing the meaning of the key in the context of active modifiers, keyboard layout, etc (e.g., ‘AltGr’) (default: ""). (optional) :windows-virtual-key-code | Windows virtual key code (default: 0). (optional) :native-virtual-key-code | Native virtual key code (default: 0). (optional) :auto-repeat | Whether the event was generated from auto repeat (default: false). (optional) :is-keypad | Whether the event was generated from the keypad (default: false). (optional) :is-system-key | Whether the event was a system key event (default: false). (optional) :location | Whether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default: 0). (optional) :commands | 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. (optional)

dispatch-mouse-event

(dispatch-mouse-event)(dispatch-mouse-event {:as params, :keys [type x y modifiers timestamp button buttons click-count force tangential-pressure tilt-x tilt-y twist delta-x delta-y pointer-type]})(dispatch-mouse-event connection {:as params, :keys [type x y modifiers timestamp button buttons click-count force tangential-pressure tilt-x tilt-y twist delta-x delta-y pointer-type]})

Dispatches a mouse event to the page.

Parameters map keys:

Key Description
:type Type of the mouse event.
:x X coordinate of the event relative to the main frame’s viewport in CSS pixels.
:y Y 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. :modifiers | Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0). (optional) :timestamp | Time at which the event occurred. (optional) :button | Mouse button (default: “none”). (optional) :buttons | A 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. (optional) :click-count | Number of times the mouse button was clicked (default: 0). (optional) :force | The normalized pressure, which has a range of 0,1(default: 0). (optional) :tangential-pressure | The normalized tangential pressure, which has a range of -1,1(default: 0). (optional) :tilt-x | The 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). (optional) :tilt-y | The 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). (optional) :twist | The clockwise rotation of a pen stylus around its own major axis, in degrees in the range 0,359(default: 0). (optional) :delta-x | X delta in CSS pixels for mouse wheel event (default: 0). (optional) :delta-y | Y delta in CSS pixels for mouse wheel event (default: 0). (optional) :pointer-type | Pointer type (default: “mouse”). (optional)

dispatch-touch-event

(dispatch-touch-event)(dispatch-touch-event {:as params, :keys [type touch-points modifiers timestamp]})(dispatch-touch-event connection {:as params, :keys [type touch-points modifiers timestamp]})

Dispatches a touch event to the page.

Parameters map keys:

Key Description
:type Type of the touch event. TouchEnd and TouchCancel must not contain any touch points, while

TouchStart and TouchMove must contains at least one. :touch-points | 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. :modifiers | Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0). (optional) :timestamp | Time at which the event occurred. (optional)

emulate-touch-from-mouse-event

(emulate-touch-from-mouse-event)(emulate-touch-from-mouse-event {:as params, :keys [type x y button timestamp delta-x delta-y modifiers click-count]})(emulate-touch-from-mouse-event connection {:as params, :keys [type x y button timestamp delta-x delta-y modifiers click-count]})

Emulates touch event from the mouse event parameters.

Parameters map keys:

Key Description
:type Type of the mouse event.
:x X coordinate of the mouse pointer in DIP.
:y Y coordinate of the mouse pointer in DIP.
:button Mouse button. Only “none”, “left”, “right” are supported.
:timestamp Time at which the event occurred (default: current time). (optional)
:delta-x X delta in DIP for mouse wheel event (default: 0). (optional)
:delta-y Y delta in DIP for mouse wheel event (default: 0). (optional)
:modifiers Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8

(default: 0). (optional) :click-count | Number of times the mouse button was clicked (default: 0). (optional)

ime-set-composition

(ime-set-composition)(ime-set-composition {:as params, :keys [text selection-start selection-end replacement-start replacement-end]})(ime-set-composition connection {:as params, :keys [text selection-start selection-end replacement-start replacement-end]})

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 map keys:

Key Description
:text The text to insert
:selection-start selection start
:selection-end selection end
:replacement-start replacement start (optional)
:replacement-end replacement end (optional)

insert-text

(insert-text)(insert-text {:as params, :keys [text]})(insert-text connection {:as params, :keys [text]})

This method emulates inserting text that doesn’t come from a key press, for example an emoji keyboard or an IME.

Parameters map keys:

Key Description
:text The text to insert.

set-ignore-input-events

(set-ignore-input-events)(set-ignore-input-events {:as params, :keys [ignore]})(set-ignore-input-events connection {:as params, :keys [ignore]})

Ignores input events (useful while auditing page).

Parameters map keys:

Key Description
:ignore Ignores input events processing when set to true.

set-intercept-drags

(set-intercept-drags)(set-intercept-drags {:as params, :keys [enabled]})(set-intercept-drags connection {:as params, :keys [enabled]})

Prevents default drag and drop behavior and instead emits Input.dragIntercepted events. Drag and drop behavior can be directly controlled via Input.dispatchDragEvent.

Parameters map keys:

Key Description
:enabled null

synthesize-pinch-gesture

(synthesize-pinch-gesture)(synthesize-pinch-gesture {:as params, :keys [x y scale-factor relative-speed gesture-source-type]})(synthesize-pinch-gesture connection {:as params, :keys [x y scale-factor relative-speed gesture-source-type]})

Synthesizes a pinch gesture over a time period by issuing appropriate touch events.

Parameters map keys:

Key Description
:x X coordinate of the start of the gesture in CSS pixels.
:y Y coordinate of the start of the gesture in CSS pixels.
:scale-factor Relative scale factor after zooming (>1.0 zooms in, <1.0 zooms out).
:relative-speed Relative pointer speed in pixels per second (default: 800). (optional)
:gesture-source-type Which type of input events to be generated (default: ‘default’, which queries the platform

for the preferred input type). (optional)

synthesize-scroll-gesture

(synthesize-scroll-gesture)(synthesize-scroll-gesture {:as params, :keys [x y x-distance y-distance x-overscroll y-overscroll prevent-fling speed gesture-source-type repeat-count repeat-delay-ms interaction-marker-name]})(synthesize-scroll-gesture connection {:as params, :keys [x y x-distance y-distance x-overscroll y-overscroll prevent-fling speed gesture-source-type repeat-count repeat-delay-ms interaction-marker-name]})

Synthesizes a scroll gesture over a time period by issuing appropriate touch events.

Parameters map keys:

Key Description
:x X coordinate of the start of the gesture in CSS pixels.
:y Y coordinate of the start of the gesture in CSS pixels.
:x-distance The distance to scroll along the X axis (positive to scroll left). (optional)
:y-distance The distance to scroll along the Y axis (positive to scroll up). (optional)
:x-overscroll The number of additional pixels to scroll back along the X axis, in addition to the given

distance. (optional) :y-overscroll | The number of additional pixels to scroll back along the Y axis, in addition to the given distance. (optional) :prevent-fling | Prevent fling (default: true). (optional) :speed | Swipe speed in pixels per second (default: 800). (optional) :gesture-source-type | Which type of input events to be generated (default: ‘default’, which queries the platform for the preferred input type). (optional) :repeat-count | The number of times to repeat the gesture (default: 0). (optional) :repeat-delay-ms | The number of milliseconds delay between each repeat. (default: 250). (optional) :interaction-marker-name | The name of the interaction markers to generate, if not empty (default: ""). (optional)

synthesize-tap-gesture

(synthesize-tap-gesture)(synthesize-tap-gesture {:as params, :keys [x y duration tap-count gesture-source-type]})(synthesize-tap-gesture connection {:as params, :keys [x y duration tap-count gesture-source-type]})

Synthesizes a tap gesture over a time period by issuing appropriate touch events.

Parameters map keys:

Key Description
:x X coordinate of the start of the gesture in CSS pixels.
:y Y coordinate of the start of the gesture in CSS pixels.
:duration Duration between touchdown and touchup events in ms (default: 50). (optional)
:tap-count Number of times to perform the tap (e.g. 2 for double tap, default: 1). (optional)
:gesture-source-type Which type of input events to be generated (default: ‘default’, which queries the platform

for the preferred input type). (optional)