How to set Network Connection type?

Hi All,

I would like to run my Tests on different Network types such as Airplane mode/Data only/WiFi only.
While trying to implement few methods I keep getting exceptions or the method does nothing.

Method I’ve tried and failed :frowning: (driver = AndroidDriver):

driver.setConnection(Connection.AIRPLANE);
Assert.assertEquals(Connection.AIRPLANE, driver.getConnection());

org.openqa.selenium.WebDriverException: unknown error (An unknown server-side error occurred. status='false'. Failed to complete internal method: 'setNetworkConnection args: [airplane_mode, true]', details: Failed to preform device setConnection: airplane_mode to true. device 8a1448c7 failed to executeShellCommand settings put global airplane_mode_on 1. null) (WARNING: The server did not provide any stacktrace information)

Found this one on the Web but it doesn’t even compile (1 = Airplane mode):
driver.setNetworkConnection(1);

Do you guys have any solution?

Cheers!

Hi Liran,

setConnection command will work OK in our next release (11.4), and you will be able to change the connection type to WiFi/Mobile data/Airplane mode without seeing these errors.
getConnection will be fixed in 11.5 release.

setNetworkConnection is not part of Android driver API, and indeed will not compile.

Regards,

Hi All,

I wanted to know If and How it is possible to set the Network Connection Type on iOS.

Hi Felix,

Unfortunately, we do not support this functionality for iOS devices.
Perhaps you could write a script that launches the settings application and manually enable/disable network connection

Regards

Thanks khaleda

I will write a script

Hey felix can u share your script for ios enable/disable network connection.