InstallApplication Method

Applies to TestComplete 15.45, last modified on December 01, 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

Installs the application archive file (.ipa) on an iOS device.

Declaration

ApplicationManagerObj.InstallApplication(ArchivePath)

ApplicationManagerObj An expression, variable or parameter that specifies a reference to an ApplicationManager object
ArchivePath [in]    Required    String    
Result Object

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

ArchivePath

Specifies the path to the application archive file (.ipa) stored on the local computer.

Result Value

If the application archive is installed successfully, the method returns the ApplicationObject object that provides information on the installed application. Otherwise, it returns an empty object (Nothing in VBScript, nil in DelphiScript, None in Python, null in JavaScript, JScript, C++Script and C#Script).

Example

The code below demonstrates how to obtain the ApplicationManager object and use it to install an application on an iOS device:

JavaScript, JScript

function Test()
{
  // Obtain the ApplicationManager object
  var deviceObj = Mobile.Device("iPhone");
  var appManagerObj = deviceObj.ApplicationManager;
  var appPath = "C:\\Work\\MyApp.ipa";

  // Install the application
  var appObj = appManagerObj.InstallApplication(appPath);
  // Launch the application
  appManagerObj.RunApplication(appObj);

  // Remove the application
  appManagerObj.RemoveApplication(appObj);
}

Python

def Test():
  # Obtain the ApplicationManager object
  deviceObj = Mobile.Device("iPhone")
  appManagerObj = deviceObj.ApplicationManager
  appPath = "C:\\Work\\MyApp.ipa"

  # Install the application
  appObj = appManagerObj.InstallApplication(appPath)
  # Launch the application
  appManagerObj.RunApplication(appObj)

  # Remove the application
  appManagerObj.RemoveApplication(appObj)

VBScript

Sub Test
  ' Obtain the ApplicationManager object
  Set deviceObj = Mobile.Device("iPhone")
  Set appManagerObj = deviceObj.ApplicationManager
  appPath = "C:\Work\MyApp.ipa"

  ' Install the application
  Set appObj = appManagerObj.InstallApplication(appPath)
  ' Launch the application
  appManagerObj.RunApplication(appObj)

  ' Remove the application
  appManagerObj.RemoveApplication(appObj)
End Sub

DelphiScript

procedure Test();
var deviceObj, appManagerObj, appObj, appPath;
begin
  // Obtain the ApplicationManager object
  deviceObj := Mobile.Device('iPhone');
  appManagerObj := deviceObj.ApplicationManager;
  appPath := 'C:\Work\MyApp.ipa';

  // Install the application
  appObj := appManagerObj.InstallApplication(appPath);
  // Launch the application
  appManagerObj.RunApplication(appObj);

  // Remove the application
  appManagerObj.RemoveApplication(appObj);
end;

C++Script, C#Script

function Test()
{
  // Obtain the ApplicationManager object
  var deviceObj = Mobile["Device"]("iPhone");
  var appManagerObj = deviceObj["ApplicationManager"];
  var appPath = "C:\\Work\\MyApp.ipa";

  // Install the application
  var appObj = appManagerObj["InstallApplication"](appPath);
  // Launch the application
  appManagerObj["RunApplication"](appObj);

  // Remove the application
  appManagerObj["RemoveApplication"](appObj);
}

See Also

RemoveApplication Method
RunApplication Method
ApplicationManager Object (Legacy Mobile Testing)
Deploying iOS Applications to Devices (Legacy)

Highlight search results