WifiInfo Object

Applies to TestComplete 14.91, last modified on July 20, 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

The WifiInfo object provides information about the Wi-Fi connection to the tested Android device. The object contains the following properties:

Note: All the properties are read-only.
Property Description

IpAddress

String. Returns the IP address of the Android device.

LinkSpeed

Integer. Returns the Wi-Fi connection speed value, in megabytes per second.

MacAddress

String. Returns the MAC address of the Android device.

SignalStrength

Integer. Returns the signal strength of the connection, in percent.

SSID

String. Returns the service set identifier (SSID) of the connection.

SupplicantState

String. Returns the status of the supplicant’s negotiation with an access point. You can find possible values of this property on the SupplicantState web page of the Android documentation:

https://developer.android.com/reference/android/net/wifi/SupplicantState.html

Example

The following example demonstrates how to obtain Wi-Fi connection data.

JavaScript, JScript

function GetWifiInfo()
{
  var DeviceWifiInfo = Mobile.Device("MyDevice").Connections.WifiInfo;
  
  // Output the Wi-Fi data
  Log.Message("Device IP address: " + DeviceWifiInfo.IpAddress);
  Log.Message("Current link speed: " + DeviceWifiInfo.LinkSpeed);
  Log.Message("MAC address: " + DeviceWifiInfo.MacAddress);
  Log.Message("Received signal strength: " + DeviceWifiInfo.SignalStrength);
  Log.Message("SSID: " + DeviceWifiInfo.SSID);
  Log.Message("Supplicant state: " + DeviceWifiInfo.SupplicantState);
}

Python

def GetWifiInfo():
    DeviceWifiInfo = Mobile.Device("MyDevice").Connections.WifiInfo
    
    # Output the Wi-Fi data
    Log.Message("Device IP address: " + DeviceWifiInfo.IpAddress)
    Log.Message("Current link speed: " + VarToStr(DeviceWifiInfo.LinkSpeed))
    Log.Message("MAC address: " + DeviceWifiInfo.MacAddress)
    Log.Message("Received signal strength: " + VarToStr(DeviceWifiInfo.SignalStrength))
    Log.Message("SSID: " + DeviceWifiInfo.SSID)
    Log.Message("Supplicant state: " + DeviceWifiInfo.SupplicantState)

VBScript

 Sub GetWifiInfo
  Set DeviceWifiInfo = Mobile.Device("MyDevice").Connections.WifiInfo
  
  ' Output the Wi-Fi data
  Log.Message("Device IP address: " & DeviceWifiInfo.IpAddress)
  Log.Message("Current link speed: " & DeviceWifiInfo.LinkSpeed)
  Log.Message("MAC address: " & DeviceWifiInfo.MacAddress)
  Log.Message("Received signal strength: " & DeviceWifiInfo.SignalStrength)
  Log.Message("SSID: " & DeviceWifiInfo.SSID)
  Log.Message("Supplicant state: " & DeviceWifiInfo.SupplicantState)
 End Sub

DelphiScript

procedure GetWifiInfo();
var DeviceWifiInfo;
begin
  DeviceWifiInfo := Mobile.Device('MyDevice').Connections.WifiInfo;
  
  // Output the Wi-Fi data
  Log.Message('Device IP address: ' + DeviceWifiInfo.IpAddress);
  Log.Message('Current link speed: ' + VarToStr(DeviceWifiInfo.LinkSpeed));
  Log.Message('MAC address: ' + DeviceWifiInfo.MacAddress);
  Log.Message('Received signal strength: ' + VarToStr(DeviceWifiInfo.SignalStrength));
  Log.Message('SSID: ' + DeviceWifiInfo.SSID);
  Log.Message('Supplicant state: ' + DeviceWifiInfo.SupplicantState);
end;

C++Script, C#Script

function GetWifiInfo()
{
  var DeviceWifiInfo = Mobile["Device"]("MyDevice").Connections["WifiInfo"]
  
  // Output the Wi-Fi data
  Log["Message"]("Device IP address: " + DeviceWifiInfo["IpAddress"]);
  Log["Message"]("Current link speed: " + DeviceWifiInfo["LinkSpeed"]);
  Log["Message"]("MAC address: " + DeviceWifiInfo["MacAddress"]);
  Log["Message"]("Received signal strength: " + DeviceWifiInfo["SignalStrength"]);
  Log["Message"]("SSID: " + DeviceWifiInfo["SSID"]);
  Log["Message"]("Supplicant state: " + DeviceWifiInfo["SupplicantState"]);
}

See Also

WifiInfo Property
Testing Android Applications (Legacy)

Highlight search results