Sync Usage

SyncInput

cdp_patches.input.SyncInput()

Kwargs
Type
Usage
Defaults

pid

int

The Main Chrome Browser Window PID to connect to. Can also be found in Chromes Task-Manager (Shift+Esc).

None

browser

sync_browsers

A Sync Browser Instance. Can be any of: (sd = selenium_driverless) (pw = playwright) selenium.webdriver.Chrome, sd.sync.webdriver.Chrome, pw.sync_api.Browser, pw.sync_api.BrowserContext

None

scale_factor

float

The Scaling Factor of the Browser. If a browser Instance is passed, this value gets determined automatically.

1.0

emulate_behaviour

bool

Whether to emulate human behaviour.

True

window_timeout

float

Timeout to wait for a window to be recognized. In Seconds.

30


SyncInput Properties

Property
Type
Usage
Defaults

emulate_behaviour

bool

Whether to emulate human behaviour.

True

window_timeout

int

The Time of how long to search for the Window in seconds.

30

base

WindowsBase | LinuxBase

The Base Interaction Layer. Can be useful in some special cases in which emulate_behaviour isnt sufficient. Only Readable.

None

scale_factor

float

The Scaling Factor of the Browser. If a browserInstance is passed, this value gets determined automatically.

1.0

sleep_timeout

float

How long to sleep after certain actions, for example in between a double-click. In Seconds.

0.01

window_timeout

float

Timeout to wait for a window to be recognized. In Seconds.

30

typing_speed

int

How fast to type in WPM.

50


SyncInput Methods

# Type Abbreviations
Pos = Union[int, float]
Button = Literal["left", "right", "middle"]
EmulateBehaviour: Optional[bool] = True
Timeout: Optional[float] = Non

# Click at the given coordinates with the given button
sync_input.click(button: Button, x: Pos, y: Pos, emulate_behaviour: EmulateBehaviour, timeout: Timeout)

# Double-Click at the given coordinates with the given button
sync_input.double_click(button: Button, x: Pos, y: Pos, emulate_behaviour: EmulateBehaviour, timeout: Timeout)

# Mouse-Down at the given coordinates with the given button
sync_input.down(button: Button, x: Pos, y: Pos, emulate_behaviour: EmulateBehaviour, timeout: Timeout)

# Mouse-Up at the given coordinates with the given button
sync_input.up(button: Button, x: Pos, y: Pos)

# Mouse-Move to the given coordinates
sync_input.move(x: Pos, y: Pos, emulate_behaviour: EmulateBehaviour, timeout: Timeout)

# Scroll the page in the given direction by the given amount
sync_input.scroll(direction: Literal["up", "down", "left", "right"], amount: int)

# Type the given text and optionally fill the input field (Like pasting)
sync_input.type(text: str, fill: Optional[bool] = False, timeout: Timeout)

Last updated