如何使用硒和javascript在chrome中设置网络限制设置
答案 0 :(得分:1)
我也花了一些时间来解决这个问题,但这似乎对我有用
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.
});