Skip to content

Commit

Permalink
Add "additionalCommands" support to DriverCommandExecutor.
Browse files Browse the repository at this point in the history
Keeping it protected as there's no existing use case for wider visibility.
Note that I opted for the more standard order of parameters
(for the overloaded methods of this sort) over that unfortunate
non-standard ordering that HttpCommandExecutor uses for some reason.
  • Loading branch information
sevaseva committed Aug 6, 2015
1 parent b0fbed0 commit 9114480
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public HttpCommandExecutor(URL addressOfRemoteServer) {
this(ImmutableMap.<String, CommandInfo>of(), addressOfRemoteServer);
}

/**
* Creates an {@link HttpCommandExecutor} that supports non-standard
* {@code additionalCommands} in addition to the standard.
*/
public HttpCommandExecutor(
Map<String, CommandInfo> additionalCommands, URL addressOfRemoteServer) {
this(additionalCommands, addressOfRemoteServer, getDefaultClientFactory());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@

import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.remote.Command;
import org.openqa.selenium.remote.CommandInfo;
import org.openqa.selenium.remote.DriverCommand;
import org.openqa.selenium.remote.HttpCommandExecutor;
import org.openqa.selenium.remote.Response;

import java.io.IOException;
import java.net.ConnectException;
import java.util.Map;

/**
* A specialized {@link HttpCommandExecutor} that will use a {@link DriverService} that lives
Expand All @@ -48,6 +50,16 @@ public DriverCommandExecutor(DriverService service) {
this.service = service;
}

/**
* Creates an {@link DriverCommandExecutor} that supports non-standard
* {@code additionalCommands} in addition to the standard.
*/
protected DriverCommandExecutor(
DriverService service, Map<String, CommandInfo> additionalCommands) {
super(additionalCommands, service.getUrl());
this.service = service;
}

/**
* Sends the {@code command} to the driver server for execution. The server will be started
* if requesting a new session. Likewise, if terminating a session, the server will be shutdown
Expand Down

0 comments on commit 9114480

Please sign in to comment.