Can i run my test on 2g, 3g and wifi mode on emulator/ simulator? To test how my tests work on different network speed?
I donât think so.
On Android emulator your network is always a âmobile networkâ. On iOS simulator it is always âWiFiâ.
What you can try is to use some tools like Network Link Conditioner - if you are using Mac computer, it is already installed there. There you can change network settings, drop certain amount of packages etc.
Genymotion allows that in paid version.
Thanks @Monika nd @Simon_K . Yes, it is not possible to test on different networks on emulators. One has to test it on Real device. In Java, to get the current network settings:
driver.getNetworkConnection();
And to set the network settings below method could be used:
public void setNetworkConnection(boolean airplaneMode, boolean wifi, boolean data){
NetworkConnectionSetting connection = new NetworkConnectionSetting(airplaneMode, wifi, data);
driver.setNetworkConnection(connection);
System.out.println(âYour current connection settings are :â + driver.getNetworkConnection());
}
Thanks,
Shanky
That doesnât change the type of connection that you have. You would need to go deeper into the settings, and allow edge/3g/4g etc. Itâs possible with Appium, you have to automate the settings âappâ.
You are right @Simon_K. Above code help you to switch to wifi, data or airplane mode only. Thank you for your help
Hi, I am looking into that as well. For Android the above works right? But how about iOS?
Appium Documentation sais: Unfortunately, at the moment Appium does not support the Selenium network connection API for iOS.
Do you have any ideas how to do it for iOS?
thanks
Jules