Skip to content Skip to sidebar Skip to footer

How Do You Set Network Throttling In Selenium Using Javascript?

How do you set the network throttling settings in chrome using selenium and javascript

Solution 1:

It did take me a bit of time to figure this out as well, but this seemed to work for me

  driver = await new Builder()
            .forBrowser(engine)
            .usingServer(testConfig.seleniumServer + 'wd/hub')
            .setChromeOptions(new chrome.Options()) //.headless()
            .build();
        driver.setNetworkConditions({
            offline: false,
            latency: 15, // Additional latency (ms).
            download_throughput: 50 * 1024, // Maximal aggregated download throughput.
            upload_throughput: 50 * 1024 // Maximal aggregated upload throughput.
        });

Post a Comment for "How Do You Set Network Throttling In Selenium Using Javascript?"