How do you set network throttling in selenium using javascript?

喜你入骨 提交于 2021-01-27 23:41:21

问题


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


回答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.
        });


来源:https://stackoverflow.com/questions/55350148/how-do-you-set-network-throttling-in-selenium-using-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!