dip.automate

The dip.automate module contains a collection of classes that allow an application to be automated.

AutomationCommands

class dip.automate.AutomationCommands

Base class: Model

The AutomationCommands class is the base class for recording a sequence of commands to automate part of an application.

sequence = Int()

The sequence number that defines the order in which this instance was created relative to other instances. This is used to ensure that automation commands defined in the same .py file are applied in the order that they are created in the file.

value = Any()

An optional value that can be passed to __init__ and used by record().

__init__(value=None)

Initialise the object.

record(robot)

Record a sequence of automation commands for a user interface using a robot.

Parameters:robot – is the Robot to use to record the commands.

AutomationError

exception dip.automate.AutomationError

Base exception: Exception

The AutomationError exception is raised when an automated command cannot be executed.

IAutomated

class dip.automate.IAutomated

Base class: Interface

The IAutomated interface is the base interface for all interfaces that define the APIs of automated items.

IAutomatedActionTrigger

class dip.automate.IAutomatedActionTrigger

Base class: IAutomated

The IAutomatedActionTrigger interface defines the API of automated widgets that trigger actions.

simulate_trigger(id, delay, action_id)

Simulate the user triggering an action.

Parameters:
  • id – is the (possibly scoped) identifier of the widget. This is normally used in exceptions.
  • delay – is the delay in milliseconds between simulated events.
  • action_id – is the identifier of the action.

IAutomatedDialog

class dip.automate.IAutomatedDialog

Base class: IAutomated

The IAutomatedDialog interface defines the API of automated dialogs.

simulate_click(id, delay, button)

Simulate the user clicking a button.

Parameters:
  • id – is the (possibly scoped) identifier of the widget. This is normally used in exceptions.
  • delay – is the delay in milliseconds between simulated events.
  • button – is the button to click.

IAutomatedEditor

class dip.automate.IAutomatedEditor

Base class: IAutomated

The IAutomatedEditor interface defines the API of automated editors.

simulate_set(id, delay, value)

Simulate the user setting the editor value.

Parameters:
  • id – is the (possibly scoped) identifier of the widget. This is normally used in exceptions.
  • delay – is the delay in milliseconds between simulated events.
  • value – is the value to set.

IAutomatedListEditor

class dip.automate.IAutomatedListEditor

Base class: IAutomated

The IAutomatedListEditor interface defines the API of automated editors that handle lists.

simulate_append(id, delay, value)

Simulate the user appending a value to the list.

Parameters:
  • id – is the (possibly scoped) identifier of the widget. This is normally used in exceptions.
  • delay – is the delay in milliseconds between simulated events.
  • value – is the value to append.
simulate_move(id, delay, from_index, to_index)

Simulate the user moving a value within the list.

Parameters:
  • id – is the (possibly scoped) identifier of the widget. This is normally used in exceptions.
  • delay – is the delay in milliseconds between simulated events.
  • from_index – is the initial index of the value being moved.
  • to_index – is the final index of the value being moved.
simulate_remove(id, delay, index)

Simulate the user removing a value from the list.

Parameters:
  • id – is the (possibly scoped) identifier of the widget. This is normally used in exceptions.
  • delay – is the delay in milliseconds between simulated events.
  • index – is the index of the value to remove.
simulate_update(id, delay, value, index, column=None)

Simulate the user updating a value in the list.

Parameters:
  • id – is the (possibly scoped) identifier of the widget. This is normally used in exceptions.
  • delay – is the delay in milliseconds between simulated events.
  • value – is the new value.
  • index – is the index of the value to update.
  • column – is the name of the attribute within the model to update. It should not be specified if the list’s elements are a simple type.

IAutomatedOptionSelector

class dip.automate.IAutomatedOptionSelector

Base class: IAutomated

The IAutomatedOptionSelector interface defines the API of automated editors that handle lists of options.

simulate_select(id, delay, index)

Simulate the user selecting an item.

Parameters:
  • id – is the (possibly scoped) identifier of the widget. This is normally used in exceptions.
  • delay – is the delay in milliseconds between simulated events.
  • index – is the index of the option.

IAutomatedShell

class dip.automate.IAutomatedShell

Base class: IAutomatedActionTrigger

The IAutomatedShell interface defines the API of automated shells.

IAutomatedTabBar

class dip.automate.IAutomatedTabBar

Base class: IAutomated

The IAutomatedTabBar interface defines the API of automated tab bars.

simulate_select(id, delay, index)

Simulate the user selecting a tab page.

Parameters:
  • id – is the (possibly scoped) identifier of the widget. This is normally used in exceptions.
  • delay – is the delay in milliseconds between simulated events.
  • index – is the index of the tab page.

IAutomatedTableEditor

class dip.automate.IAutomatedTableEditor

Base class: IAutomated

The IAutomatedTableEditor interface defines the API of automated editors that handle tables.

simulate_append(id, delay, values)

Simulate the user appending a row to the table.

Parameters:
  • id – is the (possibly scoped) identifier of the widget. This is normally used in exceptions.
  • delay – is the delay in milliseconds between simulated events.
  • values – is the sequence of values to append.
simulate_move(id, delay, from_row, from_column, to_row, to_column)

Simulate the user moving a value within the table.

Parameters:
  • id – is the (possibly scoped) identifier of the widget. This is normally used in exceptions.
  • delay – is the delay in milliseconds between simulated events.
  • from_row – is the initial row of the value being moved.
  • from_column – is the initial column of the value being moved.
  • to_row – is the final row of the value being moved.
  • to_column – is the final column of the value being moved.
simulate_remove(id, delay, row)

Simulate the user removing a row from the table.

Parameters:
  • id – is the (possibly scoped) identifier of the widget. This is normally used in exceptions.
  • delay – is the delay in milliseconds between simulated events.
  • row – is the row to remove.
simulate_update(id, delay, value, row, column)

Simulate the user updating a value in the table.

Parameters:
  • id – is the (possibly scoped) identifier of the widget. This is normally used in exceptions.
  • delay – is the delay in milliseconds between simulated events.
  • value – is the new value.
  • row – is the row of the value to update.
  • column – is the column of the value to update.

IAutomatedTrigger

class dip.automate.IAutomatedTrigger

Base class: IAutomated

The IAutomatedTrigger interface defines the API of automated editors that handle triggers.

simulate_trigger(id, delay)

Simulate the user pulling the trigger.

Parameters:
  • id – is the (possibly scoped) identifier of the widget. This is normally used in exceptions.
  • delay – is the delay in milliseconds between simulated events.

Robot

class dip.automate.Robot

Base class: Model

The Robot class manages the automation commands that can be executed by a user interface.

delay = Int(-1)

The default delay in milliseconds between the playing of individual automation commands.

timeout = Int(-1)

The default time in milliseconds to wait for a user interface widget to be visible.

clear()

Any recorded automation commands are discarded.

play(after=-1)

Any recorded automation commands are executed.

Parameters:after – is the delay in milliseconds after the start of an event loop before the commands are executed. If the value is negative then the commands are played immediately without waiting for an event loop to start.
record(id, command, *command_args, delay=-1, timeout=-1)

Record an automation command.

Parameters:
  • id – is the (possibly scoped) identifier of the widget to apply the command to.
  • command – is the name of the command to record.
  • *command_args – are the commands’s arguments.
  • delay – is the delay in milliseconds between simulated events.
  • timeout – is the time in milliseconds to wait for the user interface widget to become visible.
static simulate(id, command, *command_args, delay=-1, timeout=-1)

Immediately execute an automation command.

Parameters:
  • id – is the (possibly scoped) identifier of the widget to apply the command to.
  • command – is the name of the command to execute.
  • *command_args – are the command’s arguments.
  • delay – is the delay in milliseconds between simulated events.
  • timeout – is the time in milliseconds to wait for the user interface widget to become visible.