Network throttling with chrome and selenium

后端 未结 7 1834
生来不讨喜
生来不讨喜 2020-12-08 09:40

Google Chrome 38 introduced the new \"Device Mode & Mobile Emulation\" functionality in devtools. In addition to choosing a device for emulation, it is also possible to

7条回答
  •  一向
    一向 (楼主)
    2020-12-08 10:16

    Indeed C# Selenium latest (3.11) has NetworkConditions added. Now you can use it like this:

         var driver = new ChromeDriver(pathToDriver);
         driver.NetworkConditions = new ChromeNetworkConditions()
         {  DownloadThroughput = 5000, UploadThroughput = 5000, Latency = TimeSpan.FromMilliseconds(5) };
    

    The problem is it's not yet usable because of the bug

    https://github.com/SeleniumHQ/selenium/issues/5693

    So .Net guys will have to wait until 3.12 Selenium Release.

提交回复
热议问题