Interface IInput
public interface IInput
Properties
DragIntercepted
Emitted only when Input.setInterceptDrags is enabled. Use this data with Input.dispatchDragEvent to restore normal drag and drop behavior.
[Experimental("BIDICDP001")]
IEventSource<DragInterceptedEventArgs> DragIntercepted { get; }
Property Value
- IEventSource<DragInterceptedEventArgs>
Remarks
Event args (DragInterceptedEventArgs):
- Data
Methods
CancelDraggingAsync(string?, CancellationToken)
Cancels any active dragging in the page.
Task<CancelDraggingResult> CancelDraggingAsync(string? session = null, CancellationToken cancellationToken = default)
Parameters
sessionstringOptional CDP session override.
cancellationTokenCancellationTokenA token to cancel the asynchronous operation.
Returns
- Task<CancelDraggingResult>
A task representing the asynchronous operation, containing a CancelDraggingResult.
DispatchDragEventAsync(string, double, double, DragData, long?, string?, CancellationToken)
Dispatches a drag event into the page.
[Experimental("BIDICDP001")]
Task<DispatchDragEventResult> DispatchDragEventAsync(string type, double x, double y, DragData data, long? modifiers = null, string? session = null, CancellationToken cancellationToken = default)
Parameters
typestringType of the drag event.
xdoubleX coordinate of the event relative to the main frame's viewport in CSS pixels.
ydoubleY 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.
dataDragDatamodifierslong?Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
sessionstringOptional CDP session override.
cancellationTokenCancellationTokenA token to cancel the asynchronous operation.
Returns
- Task<DispatchDragEventResult>
A task representing the asynchronous operation, containing a DispatchDragEventResult.
DispatchKeyEventAsync(string, long?, TimeSinceEpoch?, string?, string?, string?, string?, string?, long?, long?, bool?, bool?, bool?, long?, ImmutableArray<string>?, string?, CancellationToken)
Dispatches a key event to the page.
Task<DispatchKeyEventResult> DispatchKeyEventAsync(string type, long? modifiers = null, TimeSinceEpoch? timestamp = null, string? text = null, string? unmodifiedText = null, string? keyIdentifier = null, string? code = null, string? key = null, long? windowsVirtualKeyCode = null, long? nativeVirtualKeyCode = null, bool? autoRepeat = null, bool? isKeypad = null, bool? isSystemKey = null, long? location = null, ImmutableArray<string>? commands = null, string? session = null, CancellationToken cancellationToken = default)
Parameters
typestringType of the key event.
modifierslong?Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
timestampTimeSinceEpochTime at which the event occurred.
textstringText as generated by processing a virtual key code with a keyboard layout. Not needed for for keyUp and rawKeyDown events (default: "")
unmodifiedTextstringText that would have been generated by the keyboard if no modifiers were pressed (except for shift). Useful for shortcut (accelerator) key handling (default: "").
keyIdentifierstringUnique key identifier (e.g., 'U+0041') (default: "").
codestringUnique DOM defined string value for each physical key (e.g., 'KeyA') (default: "").
keystringUnique DOM defined string value describing the meaning of the key in the context of active modifiers, keyboard layout, etc (e.g., 'AltGr') (default: "").
windowsVirtualKeyCodelong?Windows virtual key code (default: 0).
nativeVirtualKeyCodelong?Native virtual key code (default: 0).
autoRepeatbool?Whether the event was generated from auto repeat (default: false).
isKeypadbool?Whether the event was generated from the keypad (default: false).
isSystemKeybool?Whether the event was a system key event (default: false).
locationlong?Whether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default: 0).
commandsImmutableArray<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.
sessionstringOptional CDP session override.
cancellationTokenCancellationTokenA token to cancel the asynchronous operation.
Returns
- Task<DispatchKeyEventResult>
A task representing the asynchronous operation, containing a DispatchKeyEventResult.
DispatchMouseEventAsync(string, double, double, long?, TimeSinceEpoch?, MouseButton?, long?, long?, double?, double?, double?, double?, long?, double?, double?, string?, string?, CancellationToken)
Dispatches a mouse event to the page.
Task<DispatchMouseEventResult> DispatchMouseEventAsync(string type, double x, double y, long? modifiers = null, TimeSinceEpoch? timestamp = null, MouseButton? button = null, long? buttons = null, long? clickCount = null, double? force = null, double? tangentialPressure = null, double? tiltX = null, double? tiltY = null, long? twist = null, double? deltaX = null, double? deltaY = null, string? pointerType = null, string? session = null, CancellationToken cancellationToken = default)
Parameters
typestringType of the mouse event.
xdoubleX coordinate of the event relative to the main frame's viewport in CSS pixels.
ydoubleY 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.
modifierslong?Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
timestampTimeSinceEpochTime at which the event occurred.
buttonMouseButton?Mouse button (default: "none").
buttonslong?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.
clickCountlong?Number of times the mouse button was clicked (default: 0).
forcedouble?The normalized pressure, which has a range of [0,1] (default: 0).
tangentialPressuredouble?The normalized tangential pressure, which has a range of [-1,1] (default: 0).
tiltXdouble?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).
tiltYdouble?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).
twistlong?The clockwise rotation of a pen stylus around its own major axis, in degrees in the range [0,359] (default: 0).
deltaXdouble?X delta in CSS pixels for mouse wheel event (default: 0).
deltaYdouble?Y delta in CSS pixels for mouse wheel event (default: 0).
pointerTypestringPointer type (default: "mouse").
sessionstringOptional CDP session override.
cancellationTokenCancellationTokenA token to cancel the asynchronous operation.
Returns
- Task<DispatchMouseEventResult>
A task representing the asynchronous operation, containing a DispatchMouseEventResult.
DispatchTouchEventAsync(string, ImmutableArray<TouchPoint>, long?, TimeSinceEpoch?, string?, CancellationToken)
Dispatches a touch event to the page.
Task<DispatchTouchEventResult> DispatchTouchEventAsync(string type, ImmutableArray<TouchPoint> touchPoints, long? modifiers = null, TimeSinceEpoch? timestamp = null, string? session = null, CancellationToken cancellationToken = default)
Parameters
typestringType of the touch event. TouchEnd and TouchCancel must not contain any touch points, while TouchStart and TouchMove must contains at least one.
touchPointsImmutableArray<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.
modifierslong?Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
timestampTimeSinceEpochTime at which the event occurred.
sessionstringOptional CDP session override.
cancellationTokenCancellationTokenA token to cancel the asynchronous operation.
Returns
- Task<DispatchTouchEventResult>
A task representing the asynchronous operation, containing a DispatchTouchEventResult.
EmulateTouchFromMouseEventAsync(string, long, long, MouseButton, TimeSinceEpoch?, double?, double?, long?, long?, string?, CancellationToken)
Emulates touch event from the mouse event parameters.
[Experimental("BIDICDP001")]
Task<EmulateTouchFromMouseEventResult> EmulateTouchFromMouseEventAsync(string type, long x, long y, MouseButton button, TimeSinceEpoch? timestamp = null, double? deltaX = null, double? deltaY = null, long? modifiers = null, long? clickCount = null, string? session = null, CancellationToken cancellationToken = default)
Parameters
typestringType of the mouse event.
xlongX coordinate of the mouse pointer in DIP.
ylongY coordinate of the mouse pointer in DIP.
buttonMouseButtonMouse button. Only "none", "left", "right" are supported.
timestampTimeSinceEpochTime at which the event occurred (default: current time).
deltaXdouble?X delta in DIP for mouse wheel event (default: 0).
deltaYdouble?Y delta in DIP for mouse wheel event (default: 0).
modifierslong?Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
clickCountlong?Number of times the mouse button was clicked (default: 0).
sessionstringOptional CDP session override.
cancellationTokenCancellationTokenA token to cancel the asynchronous operation.
Returns
- Task<EmulateTouchFromMouseEventResult>
A task representing the asynchronous operation, containing a EmulateTouchFromMouseEventResult.
ImeSetCompositionAsync(string, long, long, long?, long?, string?, CancellationToken)
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.
[Experimental("BIDICDP001")]
Task<ImeSetCompositionResult> ImeSetCompositionAsync(string text, long selectionStart, long selectionEnd, long? replacementStart = null, long? replacementEnd = null, string? session = null, CancellationToken cancellationToken = default)
Parameters
textstringThe text to insert
selectionStartlongselection start
selectionEndlongselection end
replacementStartlong?replacement start
replacementEndlong?replacement end
sessionstringOptional CDP session override.
cancellationTokenCancellationTokenA token to cancel the asynchronous operation.
Returns
- Task<ImeSetCompositionResult>
A task representing the asynchronous operation, containing a ImeSetCompositionResult.
InsertTextAsync(string, string?, CancellationToken)
This method emulates inserting text that doesn't come from a key press, for example an emoji keyboard or an IME.
[Experimental("BIDICDP001")]
Task<InsertTextResult> InsertTextAsync(string text, string? session = null, CancellationToken cancellationToken = default)
Parameters
textstringThe text to insert.
sessionstringOptional CDP session override.
cancellationTokenCancellationTokenA token to cancel the asynchronous operation.
Returns
- Task<InsertTextResult>
A task representing the asynchronous operation, containing a InsertTextResult.
SetIgnoreInputEventsAsync(bool, string?, CancellationToken)
Ignores input events (useful while auditing page).
Task<SetIgnoreInputEventsResult> SetIgnoreInputEventsAsync(bool ignore, string? session = null, CancellationToken cancellationToken = default)
Parameters
ignoreboolIgnores input events processing when set to true.
sessionstringOptional CDP session override.
cancellationTokenCancellationTokenA token to cancel the asynchronous operation.
Returns
- Task<SetIgnoreInputEventsResult>
A task representing the asynchronous operation, containing a SetIgnoreInputEventsResult.
SetInterceptDragsAsync(bool, string?, CancellationToken)
Prevents default drag and drop behavior and instead emits Input.dragIntercepted events. Drag and drop behavior can be directly controlled via Input.dispatchDragEvent.
[Experimental("BIDICDP001")]
Task<SetInterceptDragsResult> SetInterceptDragsAsync(bool enabled, string? session = null, CancellationToken cancellationToken = default)
Parameters
enabledboolsessionstringOptional CDP session override.
cancellationTokenCancellationTokenA token to cancel the asynchronous operation.
Returns
- Task<SetInterceptDragsResult>
A task representing the asynchronous operation, containing a SetInterceptDragsResult.
SynthesizePinchGestureAsync(double, double, double, long?, GestureSourceType?, string?, CancellationToken)
Synthesizes a pinch gesture over a time period by issuing appropriate touch events.
[Experimental("BIDICDP001")]
Task<SynthesizePinchGestureResult> SynthesizePinchGestureAsync(double x, double y, double scaleFactor, long? relativeSpeed = null, GestureSourceType? gestureSourceType = null, string? session = null, CancellationToken cancellationToken = default)
Parameters
xdoubleX coordinate of the start of the gesture in CSS pixels.
ydoubleY coordinate of the start of the gesture in CSS pixels.
scaleFactordoubleRelative scale factor after zooming (>1.0 zooms in, <1.0 zooms out).
relativeSpeedlong?Relative pointer speed in pixels per second (default: 800).
gestureSourceTypeGestureSourceType?Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type).
sessionstringOptional CDP session override.
cancellationTokenCancellationTokenA token to cancel the asynchronous operation.
Returns
- Task<SynthesizePinchGestureResult>
A task representing the asynchronous operation, containing a SynthesizePinchGestureResult.
SynthesizeScrollGestureAsync(double, double, double?, double?, double?, double?, bool?, long?, GestureSourceType?, long?, long?, string?, string?, CancellationToken)
Synthesizes a scroll gesture over a time period by issuing appropriate touch events.
[Experimental("BIDICDP001")]
Task<SynthesizeScrollGestureResult> SynthesizeScrollGestureAsync(double x, double y, double? xDistance = null, double? yDistance = null, double? xOverscroll = null, double? yOverscroll = null, bool? preventFling = null, long? speed = null, GestureSourceType? gestureSourceType = null, long? repeatCount = null, long? repeatDelayMs = null, string? interactionMarkerName = null, string? session = null, CancellationToken cancellationToken = default)
Parameters
xdoubleX coordinate of the start of the gesture in CSS pixels.
ydoubleY coordinate of the start of the gesture in CSS pixels.
xDistancedouble?The distance to scroll along the X axis (positive to scroll left).
yDistancedouble?The distance to scroll along the Y axis (positive to scroll up).
xOverscrolldouble?The number of additional pixels to scroll back along the X axis, in addition to the given distance.
yOverscrolldouble?The number of additional pixels to scroll back along the Y axis, in addition to the given distance.
preventFlingbool?Prevent fling (default: true).
speedlong?Swipe speed in pixels per second (default: 800).
gestureSourceTypeGestureSourceType?Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type).
repeatCountlong?The number of times to repeat the gesture (default: 0).
repeatDelayMslong?The number of milliseconds delay between each repeat. (default: 250).
interactionMarkerNamestringThe name of the interaction markers to generate, if not empty (default: "").
sessionstringOptional CDP session override.
cancellationTokenCancellationTokenA token to cancel the asynchronous operation.
Returns
- Task<SynthesizeScrollGestureResult>
A task representing the asynchronous operation, containing a SynthesizeScrollGestureResult.
SynthesizeTapGestureAsync(double, double, long?, long?, GestureSourceType?, string?, CancellationToken)
Synthesizes a tap gesture over a time period by issuing appropriate touch events.
[Experimental("BIDICDP001")]
Task<SynthesizeTapGestureResult> SynthesizeTapGestureAsync(double x, double y, long? duration = null, long? tapCount = null, GestureSourceType? gestureSourceType = null, string? session = null, CancellationToken cancellationToken = default)
Parameters
xdoubleX coordinate of the start of the gesture in CSS pixels.
ydoubleY coordinate of the start of the gesture in CSS pixels.
durationlong?Duration between touchdown and touchup events in ms (default: 50).
tapCountlong?Number of times to perform the tap (e.g. 2 for double tap, default: 1).
gestureSourceTypeGestureSourceType?Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type).
sessionstringOptional CDP session override.
cancellationTokenCancellationTokenA token to cancel the asynchronous operation.
Returns
- Task<SynthesizeTapGestureResult>
A task representing the asynchronous operation, containing a SynthesizeTapGestureResult.