DeviceID Property

Applies to TestComplete 14.10, last modified on June 5, 2019

Description

Returns the unique identifier of a mobile device.

For iOS devices, DeviceID is the unique device identifier (UDID).

For Android devices, the DeviceID value is the same as in the output of the adb devices command:

  • for physical Android devices – the device serial number as specified in Settings | About phone (or About tablet) | Status | Serial Number.

  • for Android emulators – the string in the format emulator-<port> where <port> is the emulator’s console port (5554 by default).

  • for virtual machines running Android-x86 – the IP and port of the virtual machine.

Declaration

ProgObj.DeviceID

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’s unique identifier.

Example

The following example code posts information about the device to the test log.

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
Testing iOS Applications
DeviceName Property
AndroidDevice Object
iOSDevice Object

Highlight search results