View Source Improve this doc

setNetworkConnection

Set network connection.
Types:

  • airplane mode
  • wifi on
  • data on

These properties behave like a bitmask so if you set the network connection to 0 everything will get turned off. However if you for example set the network connection to 4 it will disable the airplane mode and turn off the wifi so that only data will be enabled. WebdriverIO provides a simplified interface to set these values without calculating bitmasks.

Note: if you have airplane mode enabled you can’t have wifi or data be enabled too (for obvious reasons)

Usage

1
browser.setNetworkConnection();

Example

setNetworkConnection.js
1
2
3
4
5
6
7
it('should emulate network connection', function () {
browser.setNetworkConnection(0) // airplane mode off, wifi off, data off
browser.setNetworkConnection(1) // airplane mode on, wifi off, data off
browser.setNetworkConnection(2) // airplane mode off, wifi on, data off
browser.setNetworkConnection(4) // airplane mode off, wifi off, data on
browser.setNetworkConnection(6) // airplane mode off, wifi on, data on
});

Support

Support for selendroid