DeviceName 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

Returns the name of the given mobile device:

  • for physical Android devices and virtual machines running Android-x86 – the device model specified in Settings | About phone (or About tablet) | Model number.

  • for Android emulators – the same value as DeviceID.

  • for iOS devices – the device name specified in Settings | General | About | Name.

The DeviceName value is used in the Select Device keyword operation, and the Mobile.SetCurrent, Mobile.TrySetCurrent, Mobile.Device scripting methods to refer to the given device.

Declaration

ProgObj.DeviceName

Read-Only Property String
ProgObj An expression, variable or parameter that specifies a reference to one of the objects listed in the Applies To section

Applies To

The property is applied to the following objects:

Property Value

A string containing the device name.

Example

JavaScript, JScript

function Test()
{
  // Specify the current device
  Mobile.SetCurrent("MyDevice");

  // Post information about the device to the log
  Log.Message(Mobile.Device().DeviceID);
  Log.Message(Mobile.Device().DeviceName);

}

Python

def Test():
  # Specify the current device
  Mobile.SetCurrent("MyDevice")

  # Post information about the device to the log
  Log.Message(Mobile.Device().DeviceID)
  Log.Message(Mobile.Device().DeviceName)

VBScript

Sub Test
  ' Specify the current device
  Call Mobile.SetCurrent("MyDevice")

  ' Post information about the device to the log
  Call Log.Message(Mobile.Device.DeviceID)
  Call Log.Message(Mobile.Device.DeviceName)

End Sub

DelphiScript

procedure Test;
begin
  // Specify the current device
  Mobile.SetCurrent('MyDevice');

  // Post information about the device to the log
  Log.Message(Mobile.Device.DeviceID);
  Log.Message(Mobile.Device.DeviceName);

end;

C++Script, C#Script

function Test()
{
  // Specify the current device
  Mobile["SetCurrent"]("MyDevice");

  // Post information about the device to the log
  Log["Message"](Mobile["Device"]["DeviceID"]);
  Log["Message"](Mobile["Device"]["DeviceName"]);

}

See Also

Testing Android Applications (Legacy)
Testing iOS Applications (Legacy)
DeviceID Property
AndroidDevice Object
iOSDevice Object

Highlight search results