WiFiEnabled Property

Applies to TestComplete 15.47, last modified on January 20, 2023
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

Specifies whether Wi-Fi is enabled on the mobile device.

Declaration

ProgObj.WiFiEnabled

Read-Write Property Boolean
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 object:

Property Value

True if Wi-Fi is enabled, and False otherwise.

Example

The following example checks if Wi-Fi is enabled on the device and posts this information to the log.

JavaScript, JScript

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

Python

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

VBScript

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

DelphiScript

procedure Test();
begin
  Mobile.SetCurrent('MyDevice');
  if Mobile.Device.Connections.WiFiEnabled then
    Log.Message('Wi-Fi 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"]("Wi-Fi is enabled")
  else
    Log["Message"]("WiFi is disabled")
}

See Also

Testing Android Applications (Legacy)
AndroidConnections Object
Working With Android Device Settings During Test Run (Legacy)

Highlight search results