I referred to one of the answers posted in this forum and when I attempted to run following code
NetworkConnection mobileDriver = (NetworkConnection) appiumDriver;
if (mobileDriver.getNetworkConnection() != ConnectionType.AIRPLANE_MODE) {
// enabling Airplane mode
mobileDriver.setNetworkConnection(ConnectionType.AIRPLANE_MODE);
}
I get following exception:
java.lang.ClassCastException: io.appium.java_client.ios.IOSDriver cannot be cast to org.openqa.selenium.mobile.NetworkConnection
Here is the link to the post which I had referred to How can I switch ON/OFF AIRPLANE mode and wifi using Appium?