问题
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