Connections Property

Applies to TestComplete 15.0, last modified on November 17, 2021
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

Use the property to get the AndroidConnections object that provides access to WiFi and Bluetooth connections on the device.

You can access this property only if the Android Agent service is installed and running on the device.

Declaration

AndroidDeviceObj.Connections

Read-Only Property An AndroidConnections object
AndroidDeviceObj An expression, variable or parameter that specifies a reference to an AndroidDevice object

Applies To

The property is applied to the following object:

Property Value

The AndroidConnection object that provides access to WiFi and Bluetooth connections on the device.

Example

The following example uses the Connections property to check if the device's WiFi is enabled and posts this information to the log.

JavaScript, JScript

function Test()
{
  Mobile.SetCurrent("MyDevice")
  if (Mobile.Device().Connections.WiFiEnabled)
    Log.Message("WiFi is enabled")
  else
    Log.Message("WiFi is disabled")
}

Python

def Test():
  Mobile.SetCurrent("MyDevice")
  if Mobile.Device().Connections.WiFiEnabled:
    Log.Message("WiFi is enabled")
  else:
    Log.Message("WiFi is disabled")

VBScript

Sub Test()
  Mobile.SetCurrent("MyDevice")
  If Mobile.Device.Connections.WiFiEnabled Then
    Log.Message("WiFi is enabled")
  Else
    Log.Message("WiFi is disabled")
  End If
End Sub

DelphiScript

procedure Test();
begin
  Mobile.SetCurrent('MyDevice');
  if Mobile.Device.Connections.WiFiEnabled then
    Log.Message('WiFi is enabled')
  else
    Log.Message('WiFi is disabled')
end;

C++Script, C#Script

function Test()
{
  Mobile["SetCurrent"]("MyDevice")
  if (Mobile["Device"].Connections["WiFiEnabled"])
    Log["Message"]("WiFi is enabled")
  else
    Log["Message"]("WiFi is disabled")
}

See Also

Testing Android Applications (Legacy)
AndroidConnections Object
AndroidDevice Object

Highlight search results