Road to automate Network feature of device using Appium

Appium provide NetworkConnectionSetting class using this we can disable and enable network setting of mobile.
Below example show you how to enable and disable network of mobile using Appium.


public void testNetwork()

                    NetworkConnectionSetting networkConnection  = (AndroidDriver driver).getNetworkConnection();

                   networkConnection.setWifi(false);

                    networkConnection.setAirplaneMode(false);

                    networkConnection.setData(true);

                  ((AndroidDriver )driver).setNetworkConnection(networkConnection);

                  networkConnection = ((AndroidDriver )driver).getNetworkConnection();

                 System.out.println("Aireplane Mode status "+networkConnection.airplaneModeEnabled());

                   System.out.println("Data Mode status "+networkConnection.dataEnabled());

                   System.out.println("Wifi Mode status "+networkConnection.wifiEnabled());

}
 









No comments:

Post a Comment

Leave your comments, queries, suggestion I will try to provide solution