Async Usage

AsyncInput

await cdp_patches.input.AsyncInput()

KwargsTypeUsageDefaults

pid

int

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

None

browser

async_browsers

An Async Browser Instance. Can be any of: (sd = selenium_driverless) (pw = playwright) sd.webdriver.Chrome, pw.async_api.Browser, pw.async_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


AsyncInput Properties

PropertyTypeUsageDefaults

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


AsyncInput 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
await async_input.click(button: Button, x: Pos, y: Pos, emulate_behaviour: EmulateBehaviour, timeout: Timeout)

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

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

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

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

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

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

Last updated