Table of Contents

Interface IInput

Namespace
Selenium.WebDriver.BiDi.Cdp.Input
Assembly
Selenium.WebDriver.BiDi.Cdp.dll
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

session string

Optional CDP session override.

cancellationToken CancellationToken

A 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

type string

Type of the drag event.

x double

X coordinate of the event relative to the main frame's viewport in CSS pixels.

y double

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 DragData
modifiers long?

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

session string

Optional CDP session override.

cancellationToken CancellationToken

A 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

type string

Type of the key event.

modifiers long?

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

timestamp TimeSinceEpoch

Time at which the event occurred.

text string

Text as generated by processing a virtual key code with a keyboard layout. Not needed for for keyUp and rawKeyDown 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 long?

Windows virtual key code (default: 0).

nativeVirtualKeyCode long?

Native virtual key code (default: 0).

autoRepeat bool?

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

isKeypad bool?

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

isSystemKey bool?

Whether the event was a system key event (default: false).

location long?

Whether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default: 0).

commands ImmutableArray<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.

session string

Optional CDP session override.

cancellationToken CancellationToken

A 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

type string

Type of the mouse event.

x double

X coordinate of the event relative to the main frame's viewport in CSS pixels.

y double

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 long?

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

timestamp TimeSinceEpoch

Time at which the event occurred.

button MouseButton?

Mouse button (default: "none").

buttons long?

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.

clickCount long?

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

force double?

The normalized pressure, which has a range of [0,1] (default: 0).

tangentialPressure double?

The normalized tangential pressure, which has a range of [-1,1] (default: 0).

tiltX double?

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).

tiltY double?

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).

twist long?

The clockwise rotation of a pen stylus around its own major axis, in degrees in the range [0,359] (default: 0).

deltaX double?

X delta in CSS pixels for mouse wheel event (default: 0).

deltaY double?

Y delta in CSS pixels for mouse wheel event (default: 0).

pointerType string

Pointer type (default: "mouse").

session string

Optional CDP session override.

cancellationToken CancellationToken

A 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

type string

Type of the touch event. TouchEnd and TouchCancel must not contain any touch points, while TouchStart and TouchMove must contains at least one.

touchPoints ImmutableArray<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.

modifiers long?

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

timestamp TimeSinceEpoch

Time at which the event occurred.

session string

Optional CDP session override.

cancellationToken CancellationToken

A 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

type string

Type of the mouse event.

x long

X coordinate of the mouse pointer in DIP.

y long

Y coordinate of the mouse pointer in DIP.

button MouseButton

Mouse button. Only "none", "left", "right" are supported.

timestamp TimeSinceEpoch

Time at which the event occurred (default: current time).

deltaX double?

X delta in DIP for mouse wheel event (default: 0).

deltaY double?

Y delta in DIP for mouse wheel event (default: 0).

modifiers long?

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

clickCount long?

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

session string

Optional CDP session override.

cancellationToken CancellationToken

A 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

text string

The text to insert

selectionStart long

selection start

selectionEnd long

selection end

replacementStart long?

replacement start

replacementEnd long?

replacement end

session string

Optional CDP session override.

cancellationToken CancellationToken

A 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

text string

The text to insert.

session string

Optional CDP session override.

cancellationToken CancellationToken

A 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

ignore bool

Ignores input events processing when set to true.

session string

Optional CDP session override.

cancellationToken CancellationToken

A 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

enabled bool
session string

Optional CDP session override.

cancellationToken CancellationToken

A 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

x double

X coordinate of the start of the gesture in CSS pixels.

y double

Y coordinate of the start of the gesture in CSS pixels.

scaleFactor double

Relative scale factor after zooming (>1.0 zooms in, <1.0 zooms out).

relativeSpeed long?

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).

session string

Optional CDP session override.

cancellationToken CancellationToken

A 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

x double

X coordinate of the start of the gesture in CSS pixels.

y double

Y coordinate of the start of the gesture in CSS pixels.

xDistance double?

The distance to scroll along the X axis (positive to scroll left).

yDistance double?

The distance to scroll along the Y axis (positive to scroll up).

xOverscroll double?

The number of additional pixels to scroll back along the X axis, in addition to the given distance.

yOverscroll double?

The number of additional pixels to scroll back along the Y axis, in addition to the given distance.

preventFling bool?

Prevent fling (default: true).

speed long?

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 long?

The number of times to repeat the gesture (default: 0).

repeatDelayMs long?

The number of milliseconds delay between each repeat. (default: 250).

interactionMarkerName string

The name of the interaction markers to generate, if not empty (default: "").

session string

Optional CDP session override.

cancellationToken CancellationToken

A 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

x double

X coordinate of the start of the gesture in CSS pixels.

y double

Y coordinate of the start of the gesture in CSS pixels.

duration long?

Duration between touchdown and touchup events in ms (default: 50).

tapCount long?

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).

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<SynthesizeTapGestureResult>

A task representing the asynchronous operation, containing a SynthesizeTapGestureResult.