PackageManager Object

Applies to TestComplete 14.93, last modified on October 12, 2021
The information below concerns legacy mobile tests that work with mobile devices connected to the local computer. For new mobile tests, we recommend using the newer cloud-compatible approach.

Description

The PackageManager object provides access to mobile application packages. You can use this object to install or remove a package, obtain the number of packages installed on a device and so on.

The object is returned by the PackageManager property of the Device object.

In order for TestComplete to be able to provide access to an Android device, the device should be connected to Android Debug Bridge.

Members

Example

The code below obtains the number of packages installed on the VirtualBox device and posts this number to the test log:

JavaScript, JScript

function Test()
{
  var DeviceObj = Mobile.Device("MyDevice");
  var PackManagerObj = DeviceObj.PackageManager;
  var Num = PackManagerObj.InstalledPackageCount;
  Log.Message("The number of installed packages is: " + aqConvert.VarToStr(Num));
}

Python

def Test():
  DeviceObj = Mobile.Device("MyDevice")
  PackManagerObj = DeviceObj.PackageManager
  Num = PackManagerObj.InstalledPackageCount
  Log.Message("The number of installed packages is: " + aqConvert.VarToStr(Num))

VBScript

Sub Test
  Set DeviceObj = Mobile.Device("MyDevice")
  Set PackManagerObj = DeviceObj.PackageManager
  Num = PackManagerObj.InstalledPackageCount
  Call Log.Message("The number of installed packages is: " + aqConvert.VarToStr(Num))
End Sub

DelphiScript

function Test;
var DeviceObj, PackManagerObj, Num: OleVariant;
begin
  DeviceObj := Mobile.Device('MyDevice');
  PackManagerObj := DeviceObj.PackageManager;
  Num := PackManagerObj.InstalledPackageCount;
  Log.Message('The number of installed packages is: ' + aqConvert.VarToStr(Num));
end;

C++Script, C#Script

function Test()
{
  var DeviceObj = Mobile["Device"]("MyDevice");
  var PackManagerObj = DeviceObj["PackageManager"];
  var Num = PackManagerObj["InstalledPackageCount"];
  Log["Message"]("The number of installed packages is: " + aqConvert["VarToStr"](Num));
}

See Also

PackageManager Property
Installing Packages on Devices (Legacy)

Highlight search results