Skip to content

[🚀 Feature]: deleteNetworkConditions missing in Javascript #10322

@slhck

Description

@slhck

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-needs-triagingA Selenium member will evaluate this soon!I-enhancementSomething could be better

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions