Description
Returns the ApplicationManager
object that provides access to applications and processes on a connected mobile device.
Depending on the mobile support type — Appium-based or legacy — that you use in your test, the implementation of the returned ApplicationManager
object varies.
Note: In legacy mobile tests, the property is available only for iOS devices.
Declaration
DeviceObj.ApplicationManager
Read-Only Property | An ApplicationManager object. |
DeviceObj | An expression, variable or parameter that specifies a reference to a Device object |
Applies To
The property is applied to the following object:
Property Value
For information on the object that the property returns in Appium-based tests, see ApplicationManager Object. Otherwise, see ApplicationManager Object (Legacy Mobile Testing).
Example
The code below shows how to get the ApplicationManager
object and how to use it to start, reset, and then stop the tested application for which the testing session is opened on the mobile device:
Note: For the example to work correctly, your project must be connected to the BitBar cloud and the bitbar_app
capability must specify a correct application ID in the BitBar file storage. If you use an iOS device, the bundleId
capability must also be specified for the testing session. See Project Properties - BitBar and Local Appium .
JavaScript
{
// Connect to a mobile device
var capabilities = {
"platformName": "ANDROID",
"bitbar_target": "android",
"bitbar_findDevice": "false",
"bitbar_device": "Google Pixel 3a Android 10",
"deviceName": "Google Pixel 3a Android 10",
"automationName": "UiAutomator2",
"bitbar_app": "1234"
};
var server = "https://appium.bitbar.com/wd/hub/";
Mobile.ConnectDevice(server, capabilities);
var appManager = Mobile.Device().ApplicationManager;
// Launch the tested application
appManager.LaunchTestedApp();
// Simulate user actions
// …
// Switch the tested application to the background mode
appManager.BackgroundTestedApp();
// …
// Reset and restart the tested application
appManager.ResetTestedApp();
// …
// Close the tested application and stop the testing session
appManager.CloseTestedApp();
}
JScript
{
// Connect to a mobile device
var capabilities = "{\"platformName\":\"ANDROID\",\"bitbar_target\":\"android\",\"bitbar_findDevice\":false,\"bitbar_device\":\"Google Pixel 3a Android 10\",\"deviceName\":\"Google Pixel 3a Android 10\",\"automationName\":\"UiAutomator2\",\"bitbar_app\":\"1234\"}";
var server = "https://appium.bitbar.com/wd/hub/";
Mobile.ConnectDevice(server, capabilities);
var appManager = Mobile.Device().ApplicationManager;
// Launch the tested application
appManager.LaunchTestedApp();
// Simulate user actions
// …
// Switch the tested application to the background mode
appManager.BackgroundTestedApp();
// …
// Reset and restart the tested application
appManager.ResetTestedApp();
// …
// Close the tested application and stop the testing session
appManager.CloseTestedApp();
}
Python
def Test():
# Connect to a mobile device
capabilities = {
"platformName": "ANDROID",
"bitbar_target": "android",
"bitbar_findDevice": "false",
"bitbar_device": "Google Pixel 3a Android 10",
"deviceName": "Google Pixel 3a Android 10",
"automationName": "UiAutomator2",
"bitbar_app": "1234"
}
server = "https://appium.bitbar.com/wd/hub/"
Mobile.ConnectDevice(server, capabilities)
appManager = Mobile.Device().ApplicationManager
# Launch the tested application
appManager.LaunchTestedApp
# Simulate user actions
# ...
# Switch the tested application to the background mode
appManager.BackgroundTestedApp
# ...
# Reset and restart the tested appication
appManager.ResetTestedApp
# ...
# Close the tested application and stop the testing session
appManager.CloseTestedApp
VBScript
Sub Test()
' Connect to a mobile device
capabilities = "{""platformName"":""ANDROID"",""bitbar_target"":""android"",""bitbar_findDevice"":false,""bitbar_device"":""Google Pixel 3a Android 10"",""deviceName"":""Google Pixel 3a Android 10"",""automationName"":""UiAutomator2"",""bitbar_app"":""1234""}"
server = "https://appium.bitbar.com/wd/hub/"
Call Mobile.ConnectDevice(server, capabilities)
Set appManager = Mobile.Device().ApplicationManager
' Launch the tested application
appManager.LaunchTestedApp
' Simulate user actions
' …
' Switch the tested application to the background mode
appManager.BackgroundTestedApp
' …
' Reset and restart the tested application
appManager.ResetTestedApp
' …
' Close the tested application and stop the testing session
appManager.CloseTestedApp
End Sub
DelphiScript
var capabilities, server, appManager;
begin
// Connect to a mobile device
capabilities := '{"platformName":"ANDROID","bitbar_target":"android","bitbar_findDevice":false,"bitbar_device":"Google Pixel 3a Android 10","deviceName":"Google Pixel 3a Android 10","automationName":"UiAutomator2","bitbar_app":"1234"}';
server := 'https://appium.bitbar.com/wd/hub/';
Mobile.ConnectDevice(server, capabilities);
appManager := Mobile.Device().ApplicationManager;
// Launch the tested application
appManager.LaunchTestedApp();
// Simulate user actions
// …
// Switch the tested application to the background mode
appManager.BackgroundTestedApp();
// …
// Reset and restart the tested application
appManager.ResetTestedApp();
// …
// Close the tested application and stop the testing session
appManager.CloseTestedApp();
end;
C++Script, C#Script
{
// Connect to a mobile device
var capabilities = "{\"platformName\":\"ANDROID\",\"bitbar_target\":\"android\",\"bitbar_findDevice\":false,\"bitbar_device\":\"Google Pixel 3a Android 10\",\"deviceName\":\"Google Pixel 3a Android 10\",\"automationName\":\"UiAutomator2\",\"bitbar_app\":\"1234\"}";
var server = "https://appium.bitbar.com/wd/hub/";
Mobile["ConnectDevice"](server, capabilities);
var appManager = Mobile["Device"]()["ApplicationManager"];
// Launch the tested application
appManager["LaunchTestedApp"]();
// Simulate user actions
// …
// Switch the tested application to the background mode
appManager["BackgroundTestedApp"]();
// …
// Reset and restart the tested application
appManager["ResetTestedApp"]();
// …
// Close the tested application and stop the testing session
appManager["CloseTestedApp"]();
}