webdriver.Chrome.set_network_conditions:Chrome网络仿真设置。
2020-04-01 18:35
1126 查看
参数
print(webdriver.Chrome.set_network_conditions.__doc__) """ Sets Chrome network emulation settings. :Args: - network_conditions: A dict with conditions specification. :Usage: driver.set_network_conditions( offline=False, latency=5, # additional latency (ms) download_throughput=500 * 1024, # maximal throughput upload_throughput=500 * 1024) # maximal throughput Note: 'throughput' can be used to set both (for download and upload). """
参数:
- offline
网络状态设置,默认为Fales(不断网),True(断网)
- latency
网络延迟设置,默认5ms
- download_throughput
下载最大吞吐量500 * 1024 500KB
- upload_throughput
上行速率最大吞吐量500 * 1024 500KB
Note: ‘throughput’ can be used to set both (for download and upload).
- throughput
可以直接设置上下行网络速率
实例说明
Broswer = webdriver.Chrome(executable_path="chromedriver", port=0, options=None, service_args=None, desired_capabilities=None, service_log_path=None, chrome_options=None, keep_alive=True) Broswer.set_network_conditions(offline=False,latency=1000,throughput=500 * 1024) print(Broswer.get_network_conditions()) """ {'download_throughput': 512000, 'latency': 1000, 'offline': False, 'upload_throughput': 512000} """
Note: 使用Broswer.get_network_conditions() 前一定要设置Broswer.set_network_conditions的全部参数。
offline设置为True任何网页都访问不了。
latency:通过设置延迟增加或减少访问网页速度。
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- selenium webdriver 之 Chrome -headless set proxy 暨 自动化测试中无头谷歌浏览器设置代理
- 理解VSTS 2010 Beta1 Network Emulation Driver(网络仿真驱动程序)
- 理解VSTS 2010 Beta1 Network Emulation Driver(网络仿真驱动程序)
- 设置Webdriver启动chrome为默认用户的配置信息
- selenium3 webdriver启动火狐、chrome、edge、Safari浏览器的方法
- webdriver 启动Firefox(geckodriver),Chrome(chromedriver)浏览器
- setwebviewclient()和setwebchromeclient()
- The path to the driver executable must be set by the webdriver.gecko.driver system property
- Selenium2(WebDriver)总结(二)---Firefox的firebug插件参数设置(补充)
- Selenium2(WebDriver)总结(一)---启动浏览器、设置profile&加载插件
- webview中setWebChromeClient和setWebClient区别
- selenium webdriver(5)---超时设置
- SetWebViewClient和 SetWebChromeClient的区别
- selenium抓取chromedriver的network
- Selenium WebDriver(IE,Firefox,Chrome)安装
- Chrome WebDriver
- 基于webdriver的IE设置
- The path to the driver executable must be set by the webdriver.gecko.driver system property;
- WebDriver拾级而上·之十八 设置元素焦点
- Selenium2中,WebDriverWait中expected_conditions.element_to_be_clickable()参数传递