DevicePath Property

Applies to TestComplete 15.31, last modified on March 17, 2022
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

Specifies the path to the package on the device. Note that this property returns the needed path only if the corresponding package has already been installed on the device. Otherwise, the property returns an empty string.

Declaration

PackageObjectObj.DevicePath

Read-Only Property String
PackageObjectObj An expression, variable or parameter that specifies a reference to a PackageObject object

Applies To

The property is applied to the following object:

Property Value

If the corresponding package is installed on the device, the property returns the path to the package on the device. If the package is not installed on the device, the property returns an empty string.

Example

The code below iterates through the packages installed on the device and posts their names and paths on the device to the test log:

JavaScript, JScript

function Test()
{
  var DeviceObj = Mobile.Device("VirtualBox");
  var PackManagerObj = DeviceObj.PackageManager;
  var Num = PackManagerObj.InstalledPackageCount;
  
  for (var i = 0; i < Num; i++)
  {
    var PackObj = PackManagerObj.InstalledPackage(i);
    // Obtain the package name
    Log.Message("The package name is: " + PackObj.Name);
    // Obtain the path to the package on the device
    Log.Message("The package device path is: " + PackObj.DevicePath);
  }
  
}

Python

def Test():
  DeviceObj = Mobile.Device("VirtualBox")
  PackManagerObj = DeviceObj.PackageManager
  Num = PackManagerObj.InstalledPackageCount
  
  for i in range (0, Num - 1):
    PackObj = PackManagerObj.InstalledPackage(i)
    # Obtain the package name
    Log.Message("The package name is: " + PackObj.Name)
    # Obtain the path to the package on the device
    Log.Message("The package device path is: " + PackObj.DevicePath)

VBScript

Sub Test
  Set DeviceObj = Mobile.Device("VirtualBox")
  Set PackManagerObj = DeviceObj.PackageManager
  Num = PackManagerObj.InstalledPackageCount
  
  For i = 0 to Num - 1
    Set PackObj = PackManagerObj.InstalledPackage(i)
    ' Obtain the package name
    Call Log.Message("The package name is: " + PackObj.Name)
    ' Obtain the path to the package on the device
    Call Log.Message("The package device path is: " + PackObj.DevicePath)
  Next
  
End Sub

DelphiScript

function Test;
var DeviceObj, PackManagerObj, Num, i, PackObj: OleVariant;
begin
  DeviceObj := Mobile.Device('VirtualBox');
  PackManagerObj := DeviceObj.PackageManager;
  Num := PackManagerObj.InstalledPackageCount;
  
  for i := 0 to Num - 1 do
  begin
    PackObj := PackManagerObj.InstalledPackage(i);
    // Obtain the package name
    Log.Message('The package name is: ' + PackObj.Name);
    // Obtain the path to the package on the device
    Log.Message('The package device path is: ' + PackObj.DevicePath);
  end;
  
end;

C++Script, C#Script

function Test()
{
  var DeviceObj = Mobile["Device"]("VirtualBox");
  var PackManagerObj = DeviceObj["PackageManager"];
  var Num = PackManagerObj["InstalledPackageCount"];
  
  for (i = 0; i < Num; i++)
  {
    var PackObj = PackManagerObj["InstalledPackage"](i);
    // Obtain the package name
    Log["Message"]( "The package name is: " + PackObj["Name"] );
    // Obtain the path to the package on the device
    Log["Message"]( "The package device path is: " + PackObj["DevicePath"] );
  }
  
}

See Also

PCPath Property
PackageObject Object

Highlight search results