fortrace.utility.desktop_environments package

Subpackages

Submodules

fortrace.utility.desktop_environments.desktop_environment module

class fortrace.utility.desktop_environments.desktop_environment.DesktopEnvironment(os_type: OSType, desktop_env: DesktopEnvironmentType, qemu_monitor_session: QEMUMonitorSession)[source]

Bases: ABC

Desktop environment of a domain.

Should be implemented by all desktop environments in ForTrace. This class is responsible for managing application windows and keeping track of the one that is currently in focus. Furthermore, it is also responsible for the login on a graphical domain.

property active_application: GenericApplication
close_application(application: GenericApplication)[source]

Close the given application via key-combination alt-f4.

Do not use the application object afterward.

Parameters:

application – application object which refers to the application that is to be closed

abstractmethod focus_application(application: GenericApplication)[source]

Bring the given application into focus so that it can receive input commands.

Parameters:

application – application object to focus

Returns:

get_application(application_identifier: str | UUID) GenericApplication[source]

Get an application based on its name or uuid

Parameters:

application_identifier – provide name if only one instance is open, else uuid

Returns:

handle to application

is_application_open(application_name: str) bool[source]

Determine if an application is opened, based on its name.

Parameters:

application_name – the name of the application to test

Returns:

Status of the application

lock_screen()[source]
abstractmethod login(username: str, password: str | None)[source]

Perform a login for the given user.

Parameters:
  • username – name of the user to login

  • password – password of the given user or None if there is none

Note

This call blocks until the desktop environment is ready to receive input.

maximize_application()[source]

Maximize the current focused application.

Note

Useful before conducting text recognition.

abstractmethod open_application(application_type: ApplicationType, application_name: str, **kwargs) GenericApplication[source]

Open the specified application and move focus to it.

Implementation has to add application to list of applications.

Parameters:
  • application_type – Type of application to filter for correct sub-factory

  • application_name – Name of the application to open

  • **kwargs – Desktop environment specific arguments, e.g. fortrace.utility.desktop_environments.Windows.Windows

Returns:

handle to newly opened application

property qemu_monitor_session: QEMUMonitorSession
property session_unlocked: bool
show_desktop()[source]

Minimized all windows and shows desktop.

Can be useful when simulating multiple applications.

Note

If executed twice, the previous window state is restored, however the focus

of the active application is lost

system_power_down()[source]

Powers down the system using the QEMUMonitor.

FIXME: On Windows guests this method may require the installation of QEMU Agent FIXME: This method should use the desktop env to power down the system

fortrace.utility.desktop_environments.desktop_environment_factory module

fortrace.utility.desktop_environments.desktop_environment_factory.get_desktop_env(os_type: OSType, desktop_env: DesktopEnvironmentType, qemu_monitor_session: QEMUMonitorSession) DesktopEnvironment[source]

Construct a new desktop environment object.

This is the entry point for any GUI interaction.

Parameters:
  • os_type – OSType of the guest

  • desktop_env – desktop environment of the guest

  • qemu_monitor_session – and active QEMUMonitorSession

Returns:

desktop environment object

Module contents