App Management¶
The AppManagement class provides functionality for launching, terminating, and managing application sessions.
optics_framework.api.app_management.AppManagement ¶
A high-level API for managing applications.
This class provides functionality for launching, terminating, and modifying app settings.
Attributes: driver (object): The driver instance for managing applications.
close_and_terminate_app() ¶
Tears down the active driver session and flushes all pending events.
Behaviour depends on the configured driver: WebDriver-based drivers (Appium, Selenium) call quit(); Playwright closes the page, context, and browser; BLE closes the serial port. All variants flush pending EventSDK events and release the driver reference.
force_terminate_app(app_name, event_name=None) ¶
Forcefully terminates the specified application.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app_name | str | The name of the application to terminate. | required |
event_name | Optional[str] | The event triggering the forced termination, if any. | None |
get_app_version(app_package=None) ¶
Gets the version of the application.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app_package | Optional[str] | The app package/bundle ID to check, or the current app if None. | None |
Returns:
| Type | Description |
|---|---|
Optional[str] | The version of the application, or None if not available. |
get_driver_session_id() ¶
Return the current driver session id, if available.
initialise_setup() ¶
Sets up the environment for the driver module.
This method should be called before performing any application management operations.
Not exposed on the Optics SDK because it currently performs no operation and doesn't delegate to the driver's own initialise_setup (e.g. AppiumDriver.initialise_setup).
launch_app(app_identifier=None, app_activity=None, event_name=None) ¶
Launches the specified application.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app_identifier | Optional[str] | The app identifier (package name for Android, bundle ID for iOS). | None |
app_activity | Optional[str] | The app activity to launch (Android only). | None |
event_name | Optional[str] | The event triggering the app launch, if any. | None |
launch_other_app(app_name, event_name=None) ¶
Starts another application.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app_name | str | The package name of the application. | required |
event_name | Optional[str] | The event triggering the app start, if any. | None |
start_appium_session(event_name=None) ¶
Starts an Appium session.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_name | Optional[str] | The event triggering the session start, if any. | None |