Feature and motivation
Currently the Javascript Chrome WebDriver only has methods to set and get the network conditions:
|
/** |
|
* Schedules a command to get Chromium network emulation settings. |
|
* @return {!Promise} A promise that will be resolved when network |
|
* emulation settings are retrievied. |
|
*/ |
|
getNetworkConditions() { |
|
return this.execute(new command.Command(Command.GET_NETWORK_CONDITIONS)) |
|
} |
|
|
|
/** |
|
* Schedules a command to set Chromium network emulation settings. |
|
* |
|
* __Sample Usage:__ |
|
* |
|
* driver.setNetworkConditions({ |
|
* offline: false, |
|
* latency: 5, // Additional latency (ms). |
|
* download_throughput: 500 * 1024, // Maximal aggregated download throughput. |
|
* upload_throughput: 500 * 1024 // Maximal aggregated upload throughput. |
|
* }); |
|
* |
|
* @param {Object} spec Defines the network conditions to set |
|
* @return {!Promise<void>} A promise that will be resolved when network |
|
* emulation settings are set. |
|
*/ |
|
setNetworkConditions(spec) { |
|
if (!spec || typeof spec !== 'object') { |
|
throw TypeError( |
|
'setNetworkConditions called with non-network-conditions parameter' |
|
) |
|
} |
|
return this.execute( |
|
new command.Command(Command.SET_NETWORK_CONDITIONS).setParameter( |
|
'network_conditions', |
|
spec |
|
) |
|
) |
|
} |
However, other languages support also deleting those conditions, e.g. in Java:
|
public void deleteNetworkConditions() { |
|
networkConditions.deleteNetworkConditions(); |
|
} |
Or Python:
|
def delete_network_conditions(self) -> NoReturn: |
|
""" |
|
Resets Chromium network emulation settings. |
|
""" |
|
self.execute("deleteNetworkConditions") |
Would it be possibe to add the same functionality to Javascript?
Usage example
driver.setNetworkConditions({ offline: false, throughput: 500, latency: 0 });
driver.deleteNetworkConditions()
Feature and motivation
Currently the Javascript Chrome WebDriver only has methods to set and get the network conditions:
selenium/javascript/node/selenium-webdriver/chromium.js
Lines 700 to 737 in 66b14c5
However, other languages support also deleting those conditions, e.g. in Java:
selenium/java/src/org/openqa/selenium/chromium/ChromiumDriver.java
Lines 286 to 288 in 66b14c5
Or Python:
selenium/py/selenium/webdriver/chromium/webdriver.py
Lines 142 to 146 in 341b454
Would it be possibe to add the same functionality to Javascript?
Usage example