MobileDevice Object

Supported in versions 14.03 and later.

Description

Represents the devices available in the Mobile tab of the Record and Run Settings dialog box.

You must have a connection set up to Mobile Center / UFT Mobile / Digital Lab / OpenText Functional Testing Lab before using this test object.

Record and Run Settings

You must have the following Record and Run Settings defined before using this test object:

  • On the Mobile tab, select Use Mobile Center, Use UFT Mobile, or Use mobile device depending on your OpenText Functional Testing version.
  • On the Web tab, select Use settings on the Mobile tab.

Then, use the MobileDevice object to switch between working with a specific device vs reserving a device by capabilities.

For example:

If the Record and Run Settings are currently defined to ...

... Set your properties as follows:

Use a specific device (by device ID)

Set the ID property to switch to using a specific device by device ID.

In such cases, do not use the ManufacturerAndModel and OSVersionCriteria properties in your script.

Reserve a device by capabilityUse the ManufacturerAndModel or the OSVersionCriteria properties to switch to reserving a device by capability.

After switching, any properties irrelevant to the current settings are set to empty. The OS property value is always kept.

Properties

ID

Defines the device ID. Required for selecting a specific device.

ManufacturerAndModel

Defines the device's manufacturer and model. Optional for selecting a device by capability.

OS

Defines the device's operating system. Required for selecting a specific device, or for selecting a device by capability.

OSVersionCriteria

Defines the device's operating system version. Optional for selecting a device by capability.

TargetLab

Read-only. Defines the device lab used in the record or run session. Optional for selecting a device by capability.

Example

Define a device to use in your test

Copy code
'Create the Application object
Set QTP = CreateObject("QuickTest.Application")
QTP.Launch 'start the testing application
QTP.Visible = True
 
'Open a test
QTP.Open "C:\Users\Administrator\Desktop\scripts\Android\UFT_Replay_Android_NativeBrowser", TRUE 
'Set the test path
Set qtMobileLauncher = QTP.Test.Settings.Launchers("Mobile")
qtMobileLauncher.Lab = "DigitalLab"  'UFT One 2023 or earlier: "MobileCenter"
qtMobileLauncher.Device.ID = "N2F4C15923006550"
qtMobileLauncher.Device.OS = "Android"
qtMobileLauncher.EnableWebSettingForMobile

'Set test options
qtMobileLauncher.InstallApps = true
qtMobileLauncher.RestartApps = true
qtMobileLauncher.UninstallApps = false
qtMobileLauncher.TrackCPUMetric = true
qtMobileLauncher.TrackMemoryMetric = true
qtMobileLauncher.TrackFreeMemoryMetric = true
qtMobileLauncher.TrackLogs = true
 
'Set result location
Set qtpResultsOpt = CreateObject("QuickTest.RunResultsOptions")
qtpResultsOpt.ResultsLocation = "C:\Users\Administrator\Desktop\scripts\Android\UFT_Replay_Android_NativeBrowser" + "\Results" 

'Run the test
QTP.Test.Run qtpResultsOpt
 
'Close the test and application
QTP.Test.Close
QTP.Quit