3
根據this issue,ChromeDriver-2.26 +中提供了Chrome DevTools的網絡調節功能。我怎樣才能在我們的量角器配置文件中指定這個?量角器:啓用網絡啓用網絡調節功能
基於四處搜索,我已經嘗試了配置文件中的幾件事情的變體。我已經爲chromeOptions添加了networkConnectionEnabled
屬性和prefs
塊,如下所示。 (請注意,我並沒有在同一時間做這兩個動作。)
multiCapabilities: [
{
'browserName': 'chrome',
'platform': 'ANY',
'networkConnectionEnabled': {'type': 'GPRS'},
'chromeOptions': {
args: [
'--lang=en',
'--window-size=1280,1024'
],
prefs: {
'net.throttling_enabled': 'true,50,20'
}
}
}
],
我根據我發現here(線1983)試圖第二個選項。這些都不會改變量角器運行的行爲,當我手動測試並設置限制觸發器時,在我的代碼中會出現一定的條件。
編輯:也嘗試添加像這樣underchromeOptions:mobileEmulation:{networkConnectionEnabled: true, networkThrottle: '2G'}
如果我沒有記錯,只有當移動仿真被激活時,節流纔可用。 –
@FlorentB。我嘗試過類似的東西(請參閱編輯),但仍然不確定是否將其設置正確。 – eflat
網絡調節現在從設備模式分離,並且能夠始終運行。 – Garbee