Simulate network conditions

Simulate different network connections and conditions to test the performance of your apps when testing on BrowserStack device cloud. When you run your tests with the default network settings, each device will have unhindered WiFi connection with Internet connectivity. With Network simulation, you can change the WiFi connection to simulate the speeds of a network profile like 2G or 3G that controls bandwidth, latency and packet loss.

Use the browserstack.networkProfile capability to simulate different network conditions.

Capability Description Value
browserstack.networkProfile Simulate different network conditions from the list of existing network profiles < profile-name >
E.g. 2g-gprs-good, 2g-gprs-lossy, 3g-umts-good etc.
Capability Description Value
browserstack.networkProfile  Simulate different network conditions from the list of existing network profiles

<profile-name>

E.g. 2g-gprs-good, 2g-gprs-lossy, 3g-umts-good etc.

Example:

desired_caps = {
    'browserstack.networkProfile': '2g-gprs-good'
}
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability("browserstack.networkProfile", "2g-gprs-good");
desired_cap = {
	'browserstack.networkProfile': '2g-gprs-good'
}
var capabilities = {
	'browserstack.networkProfile': '2g-gprs-good'
}
DesiredCapabilities capability = new DesiredCapabilities();
capability.SetCapability("browserstack.networkProfile", "2g-gprs-good");
$capabilities = new DesiredCapabilities();
$capabilities->setCapability("browserstack.networkProfile", "2g-gprs-good");

List of supported network profiles:

Profile Name Bandwidth in/out (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
2gedge-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 (Android only) 0 0 0
airplane-mode (Android only) 0 0 0
Reset Set network settings to Browserstack’s default configuration    

Switch network profiles in the middle of your test run

Use our REST API If you want to switch between different network profiles in the middle of your test run.

curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" -H "Content-Type: application/json" -d "{"networkProfile":"4g-lte-good"}" -X PUT "https://api-cloud.browserstack.com/app-automate/sessions/&lt;sessionid&gt;/update_network.json"
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" -H "Content-Type: application/json" -d "{"customNetwork":"1000,1000,100,1"}" -X PUT "https://api-cloud.browserstack.com/app-automate/sessions/&lt;sessionid&gt;/update_network.json"

Get session id using driver.session_id once the driver is created

Simulate a custom network condition

If you want to simulate a custom network condition, use the browserstack.customNetwork capability:

Capability Description Value
browserstack.customNetwork Simulate the custom network condition download speed (kbps), upload speed (kbps), latency (ms), packet loss (%)
E.g. “1000, 1000, 100, 1”
desired_caps = {
    'browserstack.customNetwork': '1000, 1000, 100, 1'
}
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability("browserstack.customNetwork", "1000, 1000, 100, 1");
desired_cap = {
	'browserstack.customNetwork': '1000, 1000, 100, 1'
}
var capabilities = {
	'browserstack.customNetwork': '1000, 1000, 100, 1'
}
DesiredCapabilities capability = new DesiredCapabilities();
capability.SetCapability("browserstack.customNetwork", "1000, 1000, 100, 1");
$capabilities = new DesiredCapabilities();
$capabilities->setCapability("browserstack.customNetwork", "1000, 1000, 100, 1");

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
Talk to an Expert