PCPath Property

Applies to TestComplete 15.47, last modified on January 20, 2023
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 local computer. Note that this property returns the needed path only if the corresponding package is located on the local computer. Otherwise, the property returns an empty string.

Declaration

PackageObjectObj.PCPath

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

The property works only for the PackageObject objects that were created with the PackageManager.GetPackageFromAPK method. If the package is located on the local computer, the property returns the path to the package on the disk. If the package is not located on the computer, the property returns an empty string. If PackageObject was not created with a GetPackageFromAPK method call, the property always returns an empty string.

Example

The example below installs an application on a device and then returns the path to the package on the device and on the local computer.

JavaScript, JScript

function Test()
{
  var DeviceObj = Mobile.Device("VirtualBox");
  var PackManagerObj = DeviceObj.PackageManager;
  var Pack = PackManagerObj.GetPackageFromAPK(aqEnvironment.GetEnvironmentVariable("Public")+"\\Documents\\TestComplete 15 Samples\\Mobile\\Android\\Orders\\Orders Application\\Bin\\Orders.apk");
  
  // Install the package
  PackManagerObj.InstallPackage(Pack);
   
  // Obtain the path to the package on the device
  Log.Message("The package device path is: " + Pack.DevicePath);
  // Obtain the path to the package on the local computer
  Log.Message("The package local path is: " + Pack.PCPath);
}

Python

def Test():
  DeviceObj = Mobile.Device("VirtualBox")
  PackManagerObj = DeviceObj.PackageManager 
  Pack = PackManagerObj.GetPackageFromAPK(aqEnvironment.GetEnvironmentVariable("Public")+"\\Documents\\TestComplete 11 Samples\\Mobile\\Android\\Orders\\Orders Application\\Bin\\Orders.apk")
  
  # Install the package
  PackManagerObj.InstallPackage(Pack)
   
  # Obtain the path to the package on the device
  Log.Message("The package device path is: " + Pack.DevicePath)
  # Obtain the path to the package on the local computer
  Log.Message("The package local path is: " + Pack.PCPath)

VBScript

Sub Test()

  Set DeviceObj = Mobile.Device("VirtualBox")
  Set PackManagerObj = DeviceObj.PackageManager
  Set Pack = PackManagerObj.GetPackageFromAPK(aqEnvironment.GetEnvironmentVariable("Public")+"\Documents\TestComplete 15 Samples\Mobile\Android\Orders\Orders Application\Bin\Orders.apk")
  
  ' Install the package
  PackManagerObj.InstallPackage(Pack)
   
  ' Obtain the path to the package on the device
  Log.Message("The package device path is: " + Pack.DevicePath)
  ' Obtain the path to the package on the local computer
  Log.Message("The package local path is: " + Pack.PCPath)
End Sub

DelphiScript

procedure Test();
var
  DeviceObj, PackManagerObj, Pack : OleVariant;
begin
  DeviceObj := Mobile.Device('VirtualBox');
  PackManagerObj := DeviceObj.PackageManager;
  Pack := PackManagerObj.GetPackageFromAPK(aqEnvironment.GetEnvironmentVariable('Public')+'\Documents\TestComplete 15 Samples\Mobile\Android\Orders\Orders Application\Bin\Orders.apk');
  
  // Install the package
  PackManagerObj.InstallPackage(Pack);
   
  // Obtain the path to the package on the device
  Log.Message('The package device path is: ' + Pack.DevicePath);
  // Obtain the path to the package on the local computer
  Log.Message('The package local path is: ' + Pack.PCPath);
end;

C++Script, C#Script

function Test()
{
  var DeviceObj = Mobile["Device"]("VirtualBox");
  var PackManagerObj = DeviceObj["PackageManager"];
  var Pack = PackManagerObj["GetPackageFromAPK"](aqEnvironment["GetEnvironmentVariable"]("Public")+"\\Documents\\TestComplete 15 Samples\\Mobile\\Android\\Orders\\Orders Application\\Bin\\Orders.apk");
  
  // Install the package
  PackManagerObj["InstallPackage"](Pack);
   
  // Obtain the path to the package on the device
  Log["Message"]("The package device path is: " + Pack["DevicePath"]);
  // Obtain the path to the package on the local computer
  Log["Message"]("The package local path is: " + Pack["PCPath"]);
}

See Also

DevicePath Property
PackageObject Object

Highlight search results