Update Network

Update Network #

client.updateNetwork((networkMode: string), (config: object));

networkMode - parameter specifies what network conditions should be used. Available network configurations and networkMode parameter values can be found here or they can be accessed using constants.

config(optional) - parameter that specifies exact network conditioner field values.

Custom network configuration is taken into effect only if provided networkMode is “custom”.

Currently available custom network configuration metrics are:

Network parameterTraffic directionJSON keyUnit of measureMin valueMax value
BandwidthOutgoingrate_upmbit0
Incomingrate_downmbit0
LatencyOutgoinglatency_upms0
Incominglatency_downms0
JitterOutgoingjitter_upms0
Incomingjitter_downms0
Packet lossOutgoingloss_up%0100
Incomingloss_down%0100
The network parameters not defined in custom network configuration will be reset to their default values.
function (browser) {
    // Example of updating network conditions using string values
    browser
        .url('https://google.com')
        .waitForElementVisible('body', 10 * 1000)
        .updateNetwork('3g');
}
function (browser) {
    // Example of updating network conditions using constants
    browser
        .url('https://google.com')
        .waitForElementVisible('body', 10000)
        .updateNetwork(loaderoConstants.network.mobile_3g);
}
function (browser) {
    // Example of updating network conditions using custom values
    let customNetworkConfig = {
        latency_up: 100,
        latency_down: 50,
        jitter_up: 20,
        jitter_down: 10,
        rate_up: 50,
        rate_down: 80,
        loss_up: 5,
        loss_down: 75
    };

    browser
        .url('https://google.com')
        .waitForElementVisible('body', 10000)
        .updateNetwork(loaderoConstants.network.custom, customNetworkConfig);
}