arsenic.actions

APIs to construct actions to be used in arsenic.session.Session.perform_actions().

chain(*ticks):

Main API to construct actions for arsenic.session.Session.perform_actions().

Parameters:ticks (Tick) – A sequence of actions to chain.
Returns:An object which can be passed to arsenic.session.Session.perform_actions().
class arsenic.actions.Button(Enum)
left
Left mouse button.
middle
Middle mouse button.
right
Right mouse button.
class arsenic.actions.Tick

Class holding an action tick, which can have multiple actions of different devices.

You should not create instances of this class yourself, but rather use APIs on Device subclasses to create them.

Tick can be used with the OR operator (|) to combine actions of multiple devices.

class arsenic.actions.Device

Abstract base class for devices.

pause(duration):

Pause this device (do nothing) for a duration in milliseconds.

This is primarily used implicitly in action chains that have multiple devices but not all devices perform an action on each tick.

Parameters:duration (int) – Duration in milliseconds of the pause.
Return type:Tick
class arsenic.actions.Pointer(Device)

Base class for pointer devices.

move_to(element, duration=250) :

Moves the pointer to an element.

Parameters:
  • element (arsenic.session.Element) – Element to move to.
  • duration (int) – Duration in milliseconds of this action.
Return type:

Tick

move_by(x, y, duration=250):

Move the pointer by a given number of pixels relative to the viewport.

Parameters:
  • x (int) – Number of pixels to move in the x-axis.
  • x – Number of pixels to move in the y-axis.
  • duration (int) – Duration in milliseconds for this action.
Return type:

Tick

down():

Holds the pointer down.

Return type:Tick
up():

Lifts the pointer up.

Return type:Tick
Mouse(Pointer):

Mouse device.

down(button=Button.left):

Hold down a mouse button.

Parameters:button (Button) – Which button to hold down.
Return type:Tick
up(button=Button.right):

Releases a mouse button.

Parameters:button (Button) – Which button to release.
Return type:Tick
Pen(Pointer):

A pen device.

Touch(Pointer):

A touch device.

Keyboard(Device):

A keyboard device.

down(key):

Holds down a specific key.

Parameters:key (str) – Which key to hold down.
Return type:Tick
up(key):

Releases a specific key.

Parameters:key (str) – Which key to release.
Return type:Tick