A simple process manager class.
The process manager is used to handle processes, windows and applications. This class should not be instantiated directly however. To get an instance of the keyboard class, call create instead.
Get an instance of the ProcessManager class.
For more infomration on picking specific backends, see Advanced Backend Picking
Parameters: | preferred_backend – A string containing a hint as to which backend you would like. Possible backends are:
|
---|---|
Raises: | RuntimeError if autopilot cannot instantate any of the possible backends. |
Raises: | RuntimeError if the preferred_backend is specified and is not one of the possible backends for this device class. |
Raises: | BackendException if the preferred_backend is set, but that backend could not be instantiated. |
Register an application with autopilot.
After calling this method, you may call start_app or start_app_window with the name parameter to start this application. You need only call this once within a test run - the application will remain registerred until the test run ends.
Parameters: |
|
---|---|
Raises: | KeyError if application has been registered already |
Unregister an application with the known_apps dictionary.
Parameters: | name – The name to be used when launching the application. |
---|---|
Raises: | KeyError if the application has not been registered. |
Start one of the known applications, and kill it on tear down.
Warning
This method will clear all instances of this application on tearDown, not just the one opened by this method! We recommend that you use the start_app_window method instead, as it is generally safer.
Parameters: |
|
---|---|
Returns: | A Application instance. |
Open a single window for one of the known applications, and close it at the end of the test.
Parameters: |
|
---|---|
Raises: | AssertionError if no window was opened, or more than one window was opened. |
Returns: | A Window instance. |
Get a list of ~autopilot.process.Window` instances for the given application name.
Parameters: | app_name – The name of one of the well-known applications. |
---|---|
Returns: | A list of Window instances. |
Get a list of the currently running applications.
If user_visible_only is True (the default), only applications visible to the user in the switcher will be returned.
Return a list of applications with the desktop file desktop_file.
This method will return an empty list if no applications are found with the specified desktop file.
Get a list of currently open windows.
If user_visible_only is True (the default), only applications visible to the user in the switcher will be returned.
The result is sorted to be in stacking order.
Wait until a given application is running.
Parameters: |
|
---|---|
Returns: | true once the application is found, or false if the application was not found until the timeout was reached. |
Launch an application by specifying a desktop file.
Parameters: | files (List of strings) – List of files to pass to the application. Not all apps support this. |
---|
Note
If wait is True, this method will wait up to 10 seconds for the application to appear.
Raises: | TypeError on invalid files parameter. |
---|---|
Returns: | The Gobject process object. |
Get the application desktop file.
This returns just the filename, not the full path. If the application no longer exists, this returns an empty string.
Get the application name.
Note
This may change according to the current locale. If you want a unique string to match applications against, use desktop_file instead.
Get the window name.
Note
This may change according to the current locale. If you want a unique string to match windows against, use the x_id instead.
Get the window title.
This may be different from the application name.
Note
This may change depending on the current locale.
Is the window maximized?
Maximized in this case means both maximized vertically and horizontally. If a window is only maximized in one direction it is not considered maximized.
Get the application that owns this window.
This method may return None if the window does not have an associated application. The ‘desktop’ window is one such example.
Is this window hidden?
Windows are hidden when the ‘Show Desktop’ mode is activated.