webdriver.Chrome.set_network_conditions:Chromeネットワークエミュレーション設定。



Webdriver Chrome Set_network_conditions



パラメータ

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). '''

パラメータ:

  • オフライン

ネットワークステータス設定、デフォルトはFales(中断されていないネットワーク)、True(切断されたネットワーク)



  • レイテンシー

ネットワーク遅延設定、デフォルトは5ms

  • download_throughput

最大スループット500 * 1024500KBをダウンロード



  • upload_throughput

最大アップストリームスループット500 * 1024 500KB

注:「スループット」を使用して、両方を設定できます(ダウンロードとアップロード用)。

  • スループット

アップリンクとダウンリンクのネットワークレートを直接設定できます



説明例

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として設定 本当 Webページにアクセスできません。latency :遅延を設定して、Webページへのアクセス速度を増減します。