RunApplication Method

Applies to TestComplete 15.70, last modified on December 17, 2024
The information below concerns legacy mobile tests that work with mobile devices connected to the local computer. For information on the ApplicationManager object available in newer cloud-compatible mobile tests, see the object description.

Description

The RunApplication method launches the specified application on an iOS device.

Declaration

ApplicationManagerObj.RunApplication(Application)

ApplicationManagerObj An expression, variable or parameter that specifies a reference to an ApplicationManager object
Application [in]    Required    The ApplicationObject object.    
Result None

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

Application

Specifies the ApplicationObject object that corresponds to the application that you want to start on the device.

Result Value

None.

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

ApplicationManager Object (Legacy Mobile Testing)
InstallApplication Method

Highlight search results