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 index of the device among other connected devices with the same name.
Declaration
ProgObj.Index
Read-Only Property | Integer |
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
An integer value that specifies the device's index (starting from zero).
Example
The code below posts the index of the specified device to the test log:
JavaScript, JScript
function PostIndex()
{
Log.Message(Mobile.Device("MobileDevice", 2).Index);
}
Python
def PostIndex():
Log.Message(Mobile.Device("MobileDevice", 2).Index)
VBScript
Sub PostIndex
Log.Message Mobile.Device("MobileDevice", 2).Index
End Sub
DelphiScript
procedure PostIndex();
begin
Log.Message(Mobile.Device('MobileDevice', 2).Index);
end;
C++Script, C#Script
function PostIndex()
{
Log["Message"](Mobile["Device"]("MobileDevice", 2)["Index"]);
}
See Also
AndroidDevice Object
iOSDevice Object
Testing Android Applications (Legacy)
Testing iOS Applications (Legacy)