Input

class selenium_driverless.input.pointer.Pointer(target, pointer_type='mouse')[source]
async down(**kwargs)[source]

press the mouse

Parameters:

kwargs – kwargs for PointerEvent

async up(**kwargs)[source]

release the mouse

Parameters:

kwargs – kwargs for PointerEvent

async click(x_or_elem=None, y=None, move_to=True, move_kwargs=None, click_kwargs=None)[source]
Parameters:
  • x_or_elem (Optional[float]) – either the x-coordinate, or a WebElement

  • y (Optional[float]) – the y-coordinate to click at

  • move_to (bool) – whether to move the pointer (recommended)

  • move_kwargs (Optional[dict]) – kwargs for Pointer.move_to

  • click_kwargs (Optional[dict]) – kwargs for BasePointer.click

async move_to(x_or_elem=None, y=None, total_time=0.5, accel=2, mid_time=None, smooth_soft=20, **kwargs)[source]

move pinter to location

Parameters:
  • x_or_elem (Optional[int]) – either the x-coordinate, or a WebElement

  • y (Optional[int]) – the y-coordinate to move to

  • total_time (float) – the total time, the pointer should take to move to the location

  • accel (float) – the acceleration & deceleration, the pointerMove should perform

  • mid_time (Optional[float]) – the normalized position, where half of the time should be due (0-1)

  • smooth_soft – how “curvy” the line should be

  • kwargs – kwargs for BasePointer.move_path

class selenium_driverless.input.pointer.BasePointer(driver, pointer_type='mouse')[source]
async dispatch(event)[source]

dispatches a PointerEVent

async down(**kwargs)[source]

press the mouse

Parameters:

kwargs – kwargs for PointerEvent

async up(**kwargs)[source]

release the mouse

Parameters:

kwargs – kwargs for PointerEvent

async click(x, y, timeout=None, **kwargs)[source]
Parameters:
  • x (float) – the x coordinate

  • y (float) – the y coordinate

  • timeout (Optional[float]) – the time to sleep between mouseUp & mouseDown

  • kwargs – kwargs for PointerEvent

async double_click(x, y, timeout=None, **kwargs)[source]

double-click

Parameters:
  • x (float) – the x coordinate

  • y (float) – the y coordinate

  • timeout (Optional[float]) – the time to sleep between mouseUp & mouseDown

  • kwargs – kwargs for PointerEvent

async move_to(x, y, **kwargs)[source]

dispatch a move event

Parameters:
  • x (int) – the x coordinate

  • y (int) – the y coordinate

  • kwargs – kwargs for PointerEvent

async move_path(total_time, pos_from_time_callback, freq_assumption=60, **kwargs)[source]

move a path

Parameters:
  • total_time (float) – total time the pointer should take to move the path

  • freq_assumption (float) – assumption on a mousemove event frequency, required for accuracy

  • kwargs – kwargs for PointerEvent

  • pos_from_time_callback (Callable[[float], Union[Tuple[int], Awaitable[Tuple[int]]]]) – a function which returns coordinates for a specific time

class selenium_driverless.input.pointer.PointerEvent(type_, x, y, modifiers=0, timestamp=None, button='left', buttons=None, click_count=0, force=0, tangential_pressure=0, tilt_x=0, tilt_y=0, twist=0, delta_x=0, delta_y=0, pointer_type='mouse')[source]
to_json()[source]

the event as JSON

Return type:

List[Union[str, Dict[str, Union[int, str]]]]

class selenium_driverless.input.pointer.Modifiers[source]
NONE = 0

no modifier

ALT = 1

alt modifier

CTRL = 2

CTRL modifier

COMMAND = 4

COMMAND modifier

SHIFT = 8

SHIFT modifier

class selenium_driverless.input.pointer.PointerType[source]
MOUSE = 'mouse'

mousePointer

PEN = 'pen'

a pointer of type “pen”

class selenium_driverless.input.pointer.MouseButton[source]

main button pressed

NONE = 'none'

no mouse button

LEFT = 'left'

left mouse button

MIDDLE = 'middle'

middle mouse button

RIGHT = 'right'

right mouse button

BACK = 'back'

back mouse button

FORWARD = 'forward'

forward mouse button

class selenium_driverless.input.pointer.Buttons[source]

modifier mouse button

NONE = 0

no button

LEFT = 1

left mouse button

RIGHT = 2

right mouse button

MIDDLE = 4

middle mouse button

BACK = 8

back mouse button

FORWARD = 16

forward mouse button

DEFAULT = None

no modifier mouse button specified

class selenium_driverless.input.pointer.EventType[source]
PRESS = 'mousePressed'

mousePressed

RELEASE = 'mouseReleased'

mouseReleased

MOVE = 'mouseMoved'

mouseMoved

WHEEL = 'mouseWheel'

mouseWheel

Select Element

async selenium_driverless.input.utils.select(elem, value=None, text=None, async_input=None, timeouts=0.01)[source]

Selects an option of a <select> element

Parameters:
  • elem (WebElement) – <select> element to select an option from

  • value (Optional[str]) – value for the option to select (can be different from the text!)

  • text (Optional[str]) – the text of the option to select

  • async_input (Optional[AsyncInput]) – an instance of cdp_patches.input.AsyncInput

  • timeouts (float) – timeout in seconds between actions performed to select an option

Return type:

None

Warning

this is potentially detectable without the use of CDP-patches !