I want to test some scenarios on my app when there is no Wifi connectivity, I need to first LogIn on good connection and then switch off the Wifi and continue doing some activities, Is it possible to disable and enable the network by code? I am using Java/Selenium and Appium Server.
Asked
Active
Viewed 2,303 times
1
-
seems like we had a wanderer prior to this as well : http://stackoverflow.com/a/31279645/1746118 – Naman Mar 01 '16 at 17:39
-
try **driver.toggleWifi()**. Its working for android device but don't know if its work on ios device – Suban Dhyako Jul 31 '18 at 09:35
4 Answers
0
try{
((HasNetworkConnection) appiumDriver).setConnection(Connection.ALL);
assertEquals(Connection.ALL,((HasNetworkConnection) appiumDriver).getConnection());
// NetworkConnectionSetting ncs = new NetworkConnectionSetting(false, true, true);
((HasNetworkConnection) appiumDriver).setConnection(Connection.NONE);
assertEquals(Connection.NONE, ((HasNetworkConnection) appiumDriver).getConnection());
}
catch(Exception e)
{e.printStackTrace();}
}

Tunaki
- 132,869
- 46
- 340
- 423

akhilesh gulati
- 128
- 8
0
This class 'NetworkConnectionSetting' works on Android. As per the request, the need is for iOS app.

Uday
- 1,433
- 10
- 36
- 57