How to turn on or off Wi Fi using Appium?

How to turn on or off wifi or data connection using appium?
If any one know it please share code.

Hi @chetan_thummar,

Try this:

adb -s shell “svc wifi enable”

Note: This can be used only for Android

Through command line? i want it to add in my test case.

Try this out.

1 Like

@Prajith_KP : tried also, not working.

im using appium v 1.13.0
Device v 9

Then execute the above mentioned adb command using a process.

Thanks for sharing. i will try this solution.

try this one @chetan_thummar
// this one for set the connection
((AndroidDriver)driver).setConnection(new ConnectionState(ConnectionState.DATA_MASK));

// and this one for checkk the connection
ConnectionState con = ((AndroidDriver)driver).getConnection();