Vai al contenuto principale

toggleWiFi

Set the WiFi state on the device.

Note: Falls back to the deprecated Appium 2 protocol endpoint if the driver does not support the mobile: execute method.

nota

Unlike the deprecated API which toggled the WiFi state, this command requires an explicit enabled parameter to set the desired state directly.

This command is only supported on Android.

Usage​

await browser.toggleWiFi(enabled)

Parameters​

NameTypeDetails
enabledbooleanSet to true to enable WiFi, false to disable it.

Example​

toggleWiFi.js
it('should set WiFi state', async () => {
await browser.toggleWiFi(true) // enable WiFi
await browser.toggleWiFi(false) // disable WiFi
})

Support​

Support for android

Supported platforms: Android

nota

Refer to the official Appium driver documentation to see which driver versions support this command.

Welcome! How can I help?

WebdriverIO AI Copilot