How to turn on or off wifi or data connection using appium?
If any one know it please share code.
How to turn on or off Wi Fi using Appium?
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.
Then execute the above mentioned adb command using a process.
https://www.tutorialspoint.com/java/lang/runtime_exec.htm
Thanks for sharing. i will try this solution.
https://appium.io/docs/en/writing-running-appium/other/network-connection/
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();
System.out.println(con.isDataEnabled());
System.out.println(con.isWiFiEnabled());