Skip to main content
Transform your testing process with: Real Device Features, Company-wide Licences, & Test Observability

Simulate Network Conditions

In many cases, you would want to test how your websites looks and performs on browsers with different networks (2G, 3G, LTE etc.,) that have varied upload & download speeds & latencies.

To simulate these network conditions on mobile browsers, you can use one of our presets, or define your own custom network conditions using the browserstack.networkProfile and browserstack.customNetwork capabilities. You can also change the network conditions mid-way during the test run, just like in real world where the end-user’s network varies.

The networkProfile and customNetwork capabilities are supported for Android and iOS devices. To simulate network conditions on desktop devices, use the Emulate Network Conditions feature supported with Selenium version 4 and higher.

Specifying the network profile to start the tests with

If you are using BrowserStack SDK, you can set the following capabilities in the browserstack.yml file:

Capability Description Expected values
networkProfile The network profile to start the test with A string.

2g-gprs-good, 4g-lte-advanced-lossy

See the list of all pre-defined network profiles
browserstack.yml
Copy icon Copy snippet

If you have unique network conditions to test in, you can use the customNetwork to specify the connection speed, latencies and the packet loss %.

Capability Description Expected values
customNetwork The custom network condition to start the test with A string.

1000,1000,100,1

Specify the desired download speed, upload speed, latency in milliseconds and packet loss percentage
browserstack.yml
Copy icon Copy snippet

BrowserStack SDK is a plug-n-play solution that takes care of all the integration steps for you. Using the BrowserStack SDK is the recommended integration method for your project. To know more, visit the SDK core concepts page.

You can use the networkProfile capability to set the network profile the test should start with. By default, each device will have unhindered WiFi connection with Internet connectivity.

Capability Description Expected values
networkProfile The network profile to start the test with A string.

2g-gprs-good, 4g-lte-advanced-lossy

See the list of all pre-defined network profiles
DesiredCapabilities capabilities = new DesiredCapabilities();
HashMap<String, Object> browserstackOptions = new HashMap<String, Object>();
browserstackOptions.put("networkProfile", "4g-lte-advanced-lossy");
capabilities.setCapability("bstack:options", browserstackOptions);
var capabilities = {
	'bstack:options' : {
		"networkProfile" : "4g-lte-advanced-lossy",
	},
}
SafariOptions capabilities = new SafariOptions();
browserstackOptions.Add("networkProfile", "4g-lte-advanced-lossy");
capabilities.AddAdditionalOption("bstack:options", browserstackOptions);
$caps = array(
	'bstack:options' => array(
		"networkProfile" => "4g-lte-advanced-lossy",
	),
)
desired_cap = {
	'bstack:options' : {
		"networkProfile" : "4g-lte-advanced-lossy",
	},
}
capabilities = {
	'bstack:options' => {
		"networkProfile" => "4g-lte-advanced-lossy",
	},
}

If you have unique network conditions to test in, you can use the customNetwork to specify the connection speed, latencies and the packet loss %.

Capability Description Expected values
customNetwork The custom network condition to start the test with A string.

1000,1000,100,1

Specify the desired download speed, upload speed, latency in milliseconds and packet loss percentage
DesiredCapabilities capabilities = new DesiredCapabilities();
HashMap<String, Object> browserstackOptions = new HashMap<String, Object>();
browserstackOptions.put("customNetwork", "1000");
capabilities.setCapability("bstack:options", browserstackOptions);
var capabilities = {
	'bstack:options' : {
		"customNetwork" : "1000",
	},
}
SafariOptions capabilities = new SafariOptions();
browserstackOptions.Add("customNetwork", "1000");
capabilities.AddAdditionalOption("bstack:options", browserstackOptions);
$caps = array(
	'bstack:options' => array(
		"customNetwork" => "1000",
	),
)
desired_cap = {
	'bstack:options' : {
		"customNetwork" : "1000",
	},
}
capabilities = {
	'bstack:options' => {
		"customNetwork" => "1000",
	},
}

You can use the browserstack.networkProfile capability to set the network profile the test should start with. By default, each device will have unhindered WiFi connection with Internet connectivity.

Capability Description Expected values
browserstack.networkProfile The network profile to start the test with A string.

2g-gprs-good, 4g-lte-advanced-lossy

See the list of all pre-defined network profiles
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("browserstack.networkProfile", "4g-lte-advanced-lossy");
var capabilities = {
 "browserstack.networkProfile" : "4g-lte-advanced-lossy"
}
OpenQA.Selenium.Safari.SafariOptions safariCapability = new OpenQA.Selenium.Safari.SafariOptions();
safariCapability.AddAdditionalCapability("browserstack.networkProfile", "4g-lte-advanced-lossy");
$caps = array(
 "browserstack.networkProfile" => "4g-lte-advanced-lossy"
);
capabilities = {
 "browserstack.networkProfile": "4g-lte-advanced-lossy"
}
caps = Selenium::WebDriver::Remote::Capabilities.new
caps["browserstack.networkProfile"] = "4g-lte-advanced-lossy"
my $capabilities = {
  "browserstack.networkProfile" => "4g-lte-advanced-lossy"
}

If you have unique network conditions to test in, you can use the browserstack.customNetwork to specify the connection speed, latencies and the packet loss %.

Capability Description Expected values
browserstack.customNetwork The custom network condition to start the test with A string.

1000,1000,100,1

Specify the desired download speed, upload speed, latency in milliseconds and packet loss percentage
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("browserstack.customNetwork", "1000");
var capabilities = {
 "browserstack.customNetwork" : "1000"
}
OpenQA.Selenium.Safari.SafariOptions safariCapability = new OpenQA.Selenium.Safari.SafariOptions();
safariCapability.AddAdditionalCapability("browserstack.customNetwork", "1000");
$caps = array(
 "browserstack.customNetwork" => "1000"
);
capabilities = {
 "browserstack.customNetwork": "1000"
}
caps = Selenium::WebDriver::Remote::Capabilities.new
caps["browserstack.customNetwork"] = "1000"
my $capabilities = {
  "browserstack.customNetwork" => "1000"
}

Changing the network profile while the tests are running

You can use the following REST API to switch network profiles in the middle of the test run.

Type Value
HTTP Method PUT
API Endpoint https://api.browserstack.com/automate/sessions/<sessionid>/update_network.json
Content type application/json
Authorization Basic authorization with your username and accesskey
JSON to send {"networkProfile":"4g-lte-good"} or {"customNetwork":"1000,1000,100,1"}

Read more about getting the session ID of the running test.

Complete list of network profiles

Profile Name Download Speed (Kbps) Upload Speed (Kbps) Latency (ms) Packet Loss (%)
2g-gprs-good 50 30 500 1
2g-gprs-lossy 30 20 650 2
edge-good 250 150 300 0
edge-lossy 150 100 500 1
3g-umts-good 400 100 100 0
3g-umts-lossy 200 50 200 1
3.5g-hspa-good 1800 400 100 0
3.5g-hspa-lossy 900 200 190 1
3.5g-hspa-plus-good 7000 1500 100 0
3.5g-hspa-plus-lossy 2000 600 130 1
4g-lte-good 18000 9000 100 0
4g-lte-high-latency 18000 9000 3000 0
4g-lte-lossy 7000 3000 120 1
4g-lte-advanced-good 25000 18000 80 0
4g-lte-advanced-lossy 15000 10000 70 1
no-network
All android and,
iOS 11 and above
0 0 0 0
airplane-mode
Android only
0 0 0 0

The no-network and airplane-mode network profiles are not supported on the following Android devices:

  • Motorola Moto G9 Play
  • Oppo Reno 3 Pro
  • Vivo Y50
  • Xiaomi Redmi Note 9
  • Huawei P30

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback!

Talk to an Expert
Download Copy