input_
DragData
dataclass
Source code in zendriver/cdp/input_.py
drag_operations_mask: int
instance-attribute
files: typing.Optional[typing.List[str]] = None
class-attribute
instance-attribute
items: typing.List[DragDataItem]
instance-attribute
__init__(items, drag_operations_mask, files=None)
from_json(json)
classmethod
Source code in zendriver/cdp/input_.py
to_json()
Source code in zendriver/cdp/input_.py
DragDataItem
dataclass
Source code in zendriver/cdp/input_.py
base_url: typing.Optional[str] = None
class-attribute
instance-attribute
data: str
instance-attribute
mime_type: str
instance-attribute
title: typing.Optional[str] = None
class-attribute
instance-attribute
__init__(mime_type, data, title=None, base_url=None)
from_json(json)
classmethod
Source code in zendriver/cdp/input_.py
to_json()
Source code in zendriver/cdp/input_.py
DragIntercepted
dataclass
EXPERIMENTAL
Emitted only when Input.setInterceptDrags
is enabled. Use this data with Input.dispatchDragEvent
to
restore normal drag and drop behavior.
Source code in zendriver/cdp/input_.py
GestureSourceType
Bases: Enum
Source code in zendriver/cdp/input_.py
DEFAULT = 'default'
class-attribute
instance-attribute
MOUSE = 'mouse'
class-attribute
instance-attribute
TOUCH = 'touch'
class-attribute
instance-attribute
from_json(json)
classmethod
MouseButton
Bases: Enum
Source code in zendriver/cdp/input_.py
BACK = 'back'
class-attribute
instance-attribute
FORWARD = 'forward'
class-attribute
instance-attribute
LEFT = 'left'
class-attribute
instance-attribute
MIDDLE = 'middle'
class-attribute
instance-attribute
NONE = 'none'
class-attribute
instance-attribute
RIGHT = 'right'
class-attribute
instance-attribute
from_json(json)
classmethod
TimeSinceEpoch
Bases: float
UTC time in seconds, counted from January 1, 1970.
Source code in zendriver/cdp/input_.py
__repr__()
from_json(json)
classmethod
TouchPoint
dataclass
Source code in zendriver/cdp/input_.py
force: typing.Optional[float] = None
class-attribute
instance-attribute
id_: typing.Optional[float] = None
class-attribute
instance-attribute
radius_x: typing.Optional[float] = None
class-attribute
instance-attribute
radius_y: typing.Optional[float] = None
class-attribute
instance-attribute
rotation_angle: typing.Optional[float] = None
class-attribute
instance-attribute
tangential_pressure: typing.Optional[float] = None
class-attribute
instance-attribute
tilt_x: typing.Optional[float] = None
class-attribute
instance-attribute
tilt_y: typing.Optional[float] = None
class-attribute
instance-attribute
twist: typing.Optional[int] = None
class-attribute
instance-attribute
x: float
instance-attribute
y: float
instance-attribute
__init__(x, y, radius_x=None, radius_y=None, rotation_angle=None, force=None, tangential_pressure=None, tilt_x=None, tilt_y=None, twist=None, id_=None)
from_json(json)
classmethod
Source code in zendriver/cdp/input_.py
to_json()
Source code in zendriver/cdp/input_.py
cancel_dragging()
Cancels any active dragging in the page.
dispatch_drag_event(type_, x, y, data, modifiers=None)
Dispatches a drag event into the page.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
type_
|
str
|
Type of the drag event. |
required |
x
|
float
|
X coordinate of the event relative to the main frame's viewport in CSS pixels. |
required |
y
|
float
|
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. |
required |
data
|
DragData
|
|
required |
modifiers
|
Optional[int]
|
(Optional) Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0). |
None
|
Source code in zendriver/cdp/input_.py
dispatch_key_event(type_, modifiers=None, timestamp=None, text=None, unmodified_text=None, key_identifier=None, code=None, key=None, windows_virtual_key_code=None, native_virtual_key_code=None, auto_repeat=None, is_keypad=None, is_system_key=None, location=None, commands=None)
Dispatches a key event to the page.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
type_
|
str
|
Type of the key event. |
required |
modifiers
|
Optional[int]
|
(Optional) Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0). |
None
|
timestamp
|
Optional[TimeSinceEpoch]
|
(Optional) Time at which the event occurred. |
None
|
text
|
Optional[str]
|
(Optional) Text as generated by processing a virtual key code with a keyboard layout. Not needed for for ```keyUp |
None
|
unmodified_text
|
Optional[str]
|
(Optional) Text that would have been generated by the keyboard if no modifiers were pressed (except for shift). Useful for shortcut (accelerator) key handling (default: ""). |
None
|
key_identifier
|
Optional[str]
|
(Optional) Unique key identifier (e.g., 'U+0041') (default: ""). |
None
|
code
|
Optional[str]
|
(Optional) Unique DOM defined string value for each physical key (e.g., 'KeyA') (default: ""). |
None
|
key
|
Optional[str]
|
(Optional) Unique DOM defined string value describing the meaning of the key in the context of active modifiers, keyboard layout, etc (e.g., 'AltGr') (default: ""). |
None
|
windows_virtual_key_code
|
Optional[int]
|
(Optional) Windows virtual key code (default: 0). |
None
|
native_virtual_key_code
|
Optional[int]
|
(Optional) Native virtual key code (default: 0). |
None
|
auto_repeat
|
Optional[bool]
|
(Optional) Whether the event was generated from auto repeat (default: false). |
None
|
is_keypad
|
Optional[bool]
|
(Optional) Whether the event was generated from the keypad (default: false). |
None
|
is_system_key
|
Optional[bool]
|
(Optional) Whether the event was a system key event (default: false). |
None
|
location
|
Optional[int]
|
(Optional) Whether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default: 0). |
None
|
commands
|
Optional[List[str]]
|
(EXPERIMENTAL) (Optional) Editing commands to send with the key event (e.g., 'selectAll') (default: []). These are related to but not equal the command names used in |
None
|
Source code in zendriver/cdp/input_.py
dispatch_mouse_event(type_, x, y, modifiers=None, timestamp=None, button=None, buttons=None, click_count=None, force=None, tangential_pressure=None, tilt_x=None, tilt_y=None, twist=None, delta_x=None, delta_y=None, pointer_type=None)
Dispatches a mouse event to the page.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
type_
|
str
|
Type of the mouse event. |
required |
x
|
float
|
X coordinate of the event relative to the main frame's viewport in CSS pixels. |
required |
y
|
float
|
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. |
required |
modifiers
|
Optional[int]
|
(Optional) Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0). |
None
|
timestamp
|
Optional[TimeSinceEpoch]
|
(Optional) Time at which the event occurred. |
None
|
button
|
Optional[MouseButton]
|
(Optional) Mouse button (default: "none"). |
None
|
buttons
|
Optional[int]
|
(Optional) 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. |
None
|
click_count
|
Optional[int]
|
(Optional) Number of times the mouse button was clicked (default: 0). |
None
|
force
|
Optional[float]
|
(EXPERIMENTAL) (Optional) The normalized pressure, which has a range of [0,1] (default: 0). |
None
|
tangential_pressure
|
Optional[float]
|
(EXPERIMENTAL) (Optional) The normalized tangential pressure, which has a range of [-1,1] (default: 0). |
None
|
tilt_x
|
Optional[float]
|
(Optional) 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). |
None
|
tilt_y
|
Optional[float]
|
(Optional) 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). |
None
|
twist
|
Optional[int]
|
(EXPERIMENTAL) (Optional) The clockwise rotation of a pen stylus around its own major axis, in degrees in the range [0,359] (default: 0). |
None
|
delta_x
|
Optional[float]
|
(Optional) X delta in CSS pixels for mouse wheel event (default: 0). |
None
|
delta_y
|
Optional[float]
|
(Optional) Y delta in CSS pixels for mouse wheel event (default: 0). |
None
|
pointer_type
|
Optional[str]
|
(Optional) Pointer type (default: "mouse"). |
None
|
Source code in zendriver/cdp/input_.py
dispatch_touch_event(type_, touch_points, modifiers=None, timestamp=None)
Dispatches a touch event to the page.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
type_
|
str
|
Type of the touch event. TouchEnd and TouchCancel must not contain any touch points, while TouchStart and TouchMove must contains at least one. |
required |
touch_points
|
List[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. |
required |
modifiers
|
Optional[int]
|
(Optional) Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0). |
None
|
timestamp
|
Optional[TimeSinceEpoch]
|
(Optional) Time at which the event occurred. |
None
|
Source code in zendriver/cdp/input_.py
emulate_touch_from_mouse_event(type_, x, y, button, timestamp=None, delta_x=None, delta_y=None, modifiers=None, click_count=None)
Emulates touch event from the mouse event parameters.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
type_
|
str
|
Type of the mouse event. |
required |
x
|
int
|
X coordinate of the mouse pointer in DIP. |
required |
y
|
int
|
Y coordinate of the mouse pointer in DIP. |
required |
button
|
MouseButton
|
Mouse button. Only "none", "left", "right" are supported. |
required |
timestamp
|
Optional[TimeSinceEpoch]
|
(Optional) Time at which the event occurred (default: current time). |
None
|
delta_x
|
Optional[float]
|
(Optional) X delta in DIP for mouse wheel event (default: 0). |
None
|
delta_y
|
Optional[float]
|
(Optional) Y delta in DIP for mouse wheel event (default: 0). |
None
|
modifiers
|
Optional[int]
|
(Optional) Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0). |
None
|
click_count
|
Optional[int]
|
(Optional) Number of times the mouse button was clicked (default: 0). |
None
|
Source code in zendriver/cdp/input_.py
ime_set_composition(text, selection_start, selection_end, replacement_start=None, replacement_end=None)
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
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
The text to insert |
required |
selection_start
|
int
|
selection start |
required |
selection_end
|
int
|
selection end |
required |
replacement_start
|
Optional[int]
|
(Optional) replacement start |
None
|
replacement_end
|
Optional[int]
|
(Optional) replacement end |
None
|
Source code in zendriver/cdp/input_.py
insert_text(text)
This method emulates inserting text that doesn't come from a key press, for example an emoji keyboard or an IME.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
The text to insert. |
required |
Source code in zendriver/cdp/input_.py
set_ignore_input_events(ignore)
Ignores input events (useful while auditing page).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ignore
|
bool
|
Ignores input events processing when set to true. |
required |
Source code in zendriver/cdp/input_.py
set_intercept_drags(enabled)
Prevents default drag and drop behavior and instead emits Input.dragIntercepted
events.
Drag and drop behavior can be directly controlled via Input.dispatchDragEvent
.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
enabled
|
bool
|
|
required |
Source code in zendriver/cdp/input_.py
synthesize_pinch_gesture(x, y, scale_factor, relative_speed=None, gesture_source_type=None)
Synthesizes a pinch gesture over a time period by issuing appropriate touch events.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
float
|
X coordinate of the start of the gesture in CSS pixels. |
required |
y
|
float
|
Y coordinate of the start of the gesture in CSS pixels. |
required |
scale_factor
|
float
|
Relative scale factor after zooming (>1.0 zooms in, <1.0 zooms out). |
required |
relative_speed
|
Optional[int]
|
(Optional) Relative pointer speed in pixels per second (default: 800). |
None
|
gesture_source_type
|
Optional[GestureSourceType]
|
(Optional) Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type). |
None
|
Source code in zendriver/cdp/input_.py
synthesize_scroll_gesture(x, y, x_distance=None, y_distance=None, x_overscroll=None, y_overscroll=None, prevent_fling=None, speed=None, gesture_source_type=None, repeat_count=None, repeat_delay_ms=None, interaction_marker_name=None)
Synthesizes a scroll gesture over a time period by issuing appropriate touch events.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
float
|
X coordinate of the start of the gesture in CSS pixels. |
required |
y
|
float
|
Y coordinate of the start of the gesture in CSS pixels. |
required |
x_distance
|
Optional[float]
|
(Optional) The distance to scroll along the X axis (positive to scroll left). |
None
|
y_distance
|
Optional[float]
|
(Optional) The distance to scroll along the Y axis (positive to scroll up). |
None
|
x_overscroll
|
Optional[float]
|
(Optional) The number of additional pixels to scroll back along the X axis, in addition to the given distance. |
None
|
y_overscroll
|
Optional[float]
|
(Optional) The number of additional pixels to scroll back along the Y axis, in addition to the given distance. |
None
|
prevent_fling
|
Optional[bool]
|
(Optional) Prevent fling (default: true). |
None
|
speed
|
Optional[int]
|
(Optional) Swipe speed in pixels per second (default: 800). |
None
|
gesture_source_type
|
Optional[GestureSourceType]
|
(Optional) Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type). |
None
|
repeat_count
|
Optional[int]
|
(Optional) The number of times to repeat the gesture (default: 0). |
None
|
repeat_delay_ms
|
Optional[int]
|
(Optional) The number of milliseconds delay between each repeat. (default: 250). |
None
|
interaction_marker_name
|
Optional[str]
|
(Optional) The name of the interaction markers to generate, if not empty (default: ""). |
None
|
Source code in zendriver/cdp/input_.py
synthesize_tap_gesture(x, y, duration=None, tap_count=None, gesture_source_type=None)
Synthesizes a tap gesture over a time period by issuing appropriate touch events.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
float
|
X coordinate of the start of the gesture in CSS pixels. |
required |
y
|
float
|
Y coordinate of the start of the gesture in CSS pixels. |
required |
duration
|
Optional[int]
|
(Optional) Duration between touchdown and touchup events in ms (default: 50). |
None
|
tap_count
|
Optional[int]
|
(Optional) Number of times to perform the tap (e.g. 2 for double tap, default: 1). |
None
|
gesture_source_type
|
Optional[GestureSourceType]
|
(Optional) Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type). |
None
|