Set network settings (FR)

Perfecto command

mobile:network.settings:set

Purpose

Sets the status of the specified network settings.

Parameters

Name Type Possible Values Description
wifi String enabled | disabled Enable/disable the device WiFi.
airplanemode String enabled | disabled Enable/disable airplane mode. Requires Android 10 (SDK 29) or later.
Enabling airplane mode disables data.

Return value

None

Exceptions

On older devices, the call returns an explicit "unsupported" error rather than silently doing nothing.

Examples

Copy

Java sample

Map<String, Object> pars = new HashMap<>();
pars.put("wifi", "enabled");
driver.executeScript("mobile:network.settings:set", pars)
Copy

C# sample

Dictionary<String, Object> pars = new Dictionary<String, Object>();
pars.Add("wifi", "enabled");
driver.ExecuteScript("mobile:network.settings:set", pars);