Is it possible to simulate the network data connection?

Can i run my test on 2g, 3g and wifi mode on emulator/ simulator? To test how my tests work on different network speed?

1 Like

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:


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);
System.out.println(“Your current connection settings are :” + driver.getNetworkConnection());


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 :relaxed:

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?