1

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.

Naman
  • 27,789
  • 26
  • 218
  • 353
Sandra
  • 105
  • 1
  • 11

4 Answers4

0

I only can recommend you use the Network Link Conditioner app from Apple. For more information please read NSHipster blog.

sig
  • 6,024
  • 2
  • 26
  • 31
0

Some potential on this topic is contained over here. You can try creating a class of yours which includes an instance of NetworkConnectionSetting in the java-client of appium and set the flags accordingly by calling the built-in methods.

Naman
  • 27,789
  • 26
  • 218
  • 353
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
0

This class 'NetworkConnectionSetting' works on Android. As per the request, the need is for iOS app.

Uday
  • 1,433
  • 10
  • 36
  • 57