Skip to content

Commit f7f09fc

Browse files
ragePoweredshs96c
authored andcommitted
[3450] Added bindings for custom ChromeDriver commands (GET_NETWORK_CONDITIONS, SET_NETWORK_CONDITIONS and DELETE_NETWORK_CONDITIONS) that allows client code to utilize built-in throttling functionality. (SeleniumHQ#3479)
1 parent bfdeb29 commit f7f09fc

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

java/client/src/org/openqa/selenium/chrome/ChromeDriverCommand.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,7 @@ final class ChromeDriverCommand {
2424
private ChromeDriverCommand() {}
2525

2626
static final String LAUNCH_APP = "launchApp";
27+
static final String GET_NETWORK_CONDITIONS = "getNetworkConditions";
28+
static final String SET_NETWORK_CONDITIONS = "setNetworkConditions";
29+
static final String DELETE_NETWORK_CONDITIONS = "deleteNetworkConditions";
2730
}

java/client/src/org/openqa/selenium/chrome/ChromeDriverCommandExecutor.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,21 @@
2525

2626
/**
2727
* {@link DriverCommandExecutor} that understands ChromeDriver specific commands.
28+
*
29+
* @see <a href="https://chromium.googlesource.com/chromium/src/+/master/chrome/test/chromedriver/client/command_executor.py">List of ChromeWebdriver commands</a>
2830
*/
2931
class ChromeDriverCommandExecutor extends DriverCommandExecutor {
3032

3133
private static final ImmutableMap<String, CommandInfo> CHROME_COMMAND_NAME_TO_URL = ImmutableMap.of(
3234
ChromeDriverCommand.LAUNCH_APP,
33-
new CommandInfo("/session/:sessionId/chromium/launch_app", HttpMethod.POST));
35+
new CommandInfo("/session/:sessionId/chromium/launch_app", HttpMethod.POST),
36+
ChromeDriverCommand.GET_NETWORK_CONDITIONS,
37+
new CommandInfo("/session/:sessionId/chromium/network_conditions", HttpMethod.GET),
38+
ChromeDriverCommand.SET_NETWORK_CONDITIONS,
39+
new CommandInfo("/session/:sessionId/chromium/network_conditions", HttpMethod.POST),
40+
ChromeDriverCommand.DELETE_NETWORK_CONDITIONS,
41+
new CommandInfo("/session/:sessionId/chromium/network_conditions", HttpMethod.DELETE)
42+
);
3443

3544
public ChromeDriverCommandExecutor(DriverService service) {
3645
super(service, CHROME_COMMAND_NAME_TO_URL);

0 commit comments

Comments
 (0)