ddp_utils.browser.facade.input¶
import ddp_utils.browser.facade.input
Backend-neutral keyboard, mouse, and touchscreen input services.
- class ddp_utils.browser.facade.input.BrowserKeyboard(browser: Browser)¶
Bases:
objectSend keyboard input to the active page or focused element.
Parameters
Name
Type
Description
browser
Owning browser facade.
Examples
Type into the currently focused control:
browser.keyboard.type("John Smith", delay=0.05)
Bind keyboard input to one browser session.
Parameters
Name
Type
Description
browser
Owning browser facade.
Examples
Browser creates this service once:
keyboard = BrowserKeyboard(browser)
- type(text: Any, *, delay: float = 0) None¶
Type text using individual keyboard events.
Parameters
Name
Type
Description
text
Any
Value converted to text.
delay
float
Delay between characters in seconds.
Raises
Exception
Description
Delay is negative or the provider rejects input.
Keyboard input is unavailable.
Examples
Type with a human-visible cadence:
browser.keyboard.type("Fulton", delay=0.04)
- insert_text(text: Any) None¶
Insert text without synthesizing one key event per character.
Parameters
Name
Type
Description
text
Any
Value converted to text.
Raises
Exception
Description
No editable element is focused.
Keyboard input is unavailable.
Examples
Insert a large value efficiently:
browser.keyboard.insert_text(payload)
- press(key: str, *, delay: float = 0) None¶
Press a key or
+-separated key combination.Parameters
Name
Type
Description
key
str
Key name or combination such as
Control+A.delay
float
Delay between key down and key up in seconds.
Raises
Exception
Description
Delay is negative or the key is empty.
Keyboard input is unavailable.
Examples
Select all focused text:
browser.keyboard.press("Control+A")
- down(key: str) None¶
Hold one keyboard key down.
Parameters
Name
Type
Description
key
str
Key name.
Raises
Exception
Description
Keyboard input is unavailable.
Examples
Hold Shift for a following action:
browser.keyboard.down("Shift")
- up(key: str) None¶
Release one keyboard key.
Parameters
Name
Type
Description
key
str
Key name.
Raises
Exception
Description
Keyboard input is unavailable.
Examples
Release Shift after a following action:
browser.keyboard.up("Shift")
- class ddp_utils.browser.facade.input.BrowserMouse(browser: Browser)¶
Bases:
objectSend normalized coordinate-based pointer input.
Parameters
Name
Type
Description
browser
Owning browser facade.
Examples
Move and click through the same API on every managed backend:
browser.mouse.move(300, 240) browser.mouse.click(300, 240)
Bind mouse input to one browser session.
Parameters
Name
Type
Description
browser
Owning browser facade.
Examples
Browser creates this service once:
mouse = BrowserMouse(browser)
- move(x: float, y: float, *, steps: int = 1) None¶
Move the pointer to viewport coordinates.
Parameters
Name
Type
Description
x
float
Horizontal viewport coordinate.
y
float
Vertical viewport coordinate.
steps
int
Number of interpolation steps.
Raises
Exception
Description
Steps are invalid.
Mouse input is unavailable.
Examples
Move gradually to a control:
browser.mouse.move(420, 180, steps=12)
- click(x: float, y: float, *, button: str = 'left', count: int = 1, delay: float = 0) None¶
Click viewport coordinates with the requested button.
Parameters
Name
Type
Description
x
float
Horizontal viewport coordinate.
y
float
Vertical viewport coordinate.
button
str
Left, middle, right, back, or forward.
count
int
Click count.
delay
float
Delay between pointer down and up in seconds.
Raises
Exception
Description
Count or delay is invalid.
Mouse input is unavailable.
Examples
Right-click one point:
browser.mouse.click(400, 200, button="right")
- double_click(x: float, y: float, **options: Any) None¶
Double-click viewport coordinates.
Parameters
Name
Type
Description
x
float
Horizontal viewport coordinate.
y
float
Vertical viewport coordinate.
**options
Any
Optional button and delay accepted by
click().Raises
Exception
Description
Options are invalid.
Mouse input is unavailable.
Examples
Double-click a result row:
browser.mouse.double_click(320, 480)
- down(*, button: str = 'left', count: int = 1) None¶
Hold a mouse button down.
Parameters
Name
Type
Description
button
str
Pointer button name.
count
int
Provider click-count metadata.
Raises
Exception
Description
Mouse input is unavailable.
Examples
Begin a custom drag sequence:
browser.mouse.down(button="left")
- up(*, button: str = 'left', count: int = 1) None¶
Release a mouse button.
Parameters
Name
Type
Description
button
str
Pointer button name.
count
int
Provider click-count metadata.
Raises
Exception
Description
Mouse input is unavailable.
Examples
End a custom drag sequence:
browser.mouse.up(button="left")
- wheel(delta_x: int, delta_y: int) None¶
Scroll using mouse-wheel deltas.
Parameters
Name
Type
Description
delta_x
int
Horizontal wheel delta.
delta_y
int
Vertical wheel delta.
Raises
Exception
Description
Mouse input is unavailable.
Examples
Scroll down one viewport-sized step:
browser.mouse.wheel(0, 700)
- drag(start_x: float, start_y: float, end_x: float, end_y: float, *, button: str = 'left', steps: int = 10, duration: float | None = None) None¶
Drag the pointer between viewport coordinates.
Parameters
Name
Type
Description
start_x
float
Starting horizontal coordinate.
start_y
float
Starting vertical coordinate.
end_x
float
Final horizontal coordinate.
end_y
float
Final vertical coordinate.
button
str
Held pointer button.
steps
int
Interpolation step count.
duration
float | None
Optional total movement duration in seconds.
Raises
Exception
Description
Steps or duration are invalid.
Mouse input is unavailable.
Examples
Drag a slider handle:
browser.mouse.drag(100, 200, 400, 200, duration=0.8)
- class ddp_utils.browser.facade.input.BrowserTouchscreen(browser: Browser)¶
Bases:
objectSend normalized touch input when the backend can preserve it.
Parameters
Name
Type
Description
browser
Owning browser facade.
Examples
Tap one viewport point:
browser.touchscreen.tap(220, 640)
Bind touch input to one browser session.
Parameters
Name
Type
Description
browser
Owning browser facade.
Examples
Browser creates this service once:
touchscreen = BrowserTouchscreen(browser)
- tap(x: float, y: float) None¶
Tap one viewport coordinate.
Parameters
Name
Type
Description
x
float
Horizontal viewport coordinate.
y
float
Vertical viewport coordinate.
Raises
Exception
Description
Touch input is unavailable.
Examples
Tap a mobile navigation control:
browser.touchscreen.tap(32, 32)
- drag(start_x: float, start_y: float, end_x: float, end_y: float, *, steps: int = 10, duration: float | None = None) None | CapabilityResult[Any]¶
Perform a touch drag gesture between viewport coordinates.
Parameters
Name
Type
Description
start_x
float
Starting horizontal coordinate.
start_y
float
Starting vertical coordinate.
end_x
float
Final horizontal coordinate.
end_y
float
Final vertical coordinate.
steps
int
Interpolation step count.
duration
float | None
Optional total gesture duration in seconds.
Returns
Type
Description
None | CapabilityResult[Any]
Noneafter a native Selenium touch gesture, or a supported result describing the standards-compatible browser event adapter.Raises
Exception
Description
Steps or duration are invalid.
Touch input is unavailable.
Examples
Swipe a mobile carousel:
browser.touchscreen.drag(500, 400, 100, 400, duration=0.6)