Skip to content

Commit 46d7920

Browse files
committed
Adding ability to add custom wire protocol commands in .NET bindings.
This commit allows projects that use a WebDriver-like JSON-over-HTTP wire protocol to add additional end points for their use. It does this by exposing (and renaming) a formally internal method on the singleton CommandInfoRepository class. To add additonal commands, one would call the TryAddCommand method, which is now public. Fixes issue #8594.
1 parent 5cc33b8 commit 46d7920

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Diff for: dotnet/src/webdriver/PhantomJS/PhantomJSDriver.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public PhantomJSDriver(PhantomJSDriverService service, PhantomJSOptions options,
151151
{
152152
// Add the custom commandInfo of PhantomJSDriver
153153
CommandInfo commandInfo = new CommandInfo(CommandInfo.PostCommand, "/session/{sessionId}/phantom/execute");
154-
CommandInfoRepository.Instance.TryAddAdditionalCommand(CommandExecutePhantomScript, commandInfo);
154+
CommandInfoRepository.Instance.TryAddCommand(CommandExecutePhantomScript, commandInfo);
155155
}
156156

157157
/// <summary>

Diff for: dotnet/src/webdriver/Remote/CommandInfoRepository.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,17 @@ public CommandInfo GetCommandInfo(string commandName)
9494
}
9595

9696
/// <summary>
97-
/// Tries the add an additional command to the list of known commands.
97+
/// Tries to add a command to the list of known commands.
9898
/// </summary>
9999
/// <param name="commandName">Name of the command.</param>
100100
/// <param name="commandInfo">The command information.</param>
101101
/// <returns><see langword="true"/> if the new command has been added successfully; otherwise, <see langword="false"/>.</returns>
102102
/// <remarks>
103103
/// This method is used by WebDriver implementations to add additional custom driver-specific commands.
104-
/// This method will not overwrite existing commands for a specific name.
104+
/// This method will not overwrite existing commands for a specific name, and will return <see langword="false"/>
105+
/// in that case.
105106
/// </remarks>
106-
internal bool TryAddAdditionalCommand(string commandName, CommandInfo commandInfo)
107+
public bool TryAddCommand(string commandName, CommandInfo commandInfo)
107108
{
108109
if (string.IsNullOrEmpty(commandName))
109110
{

0 commit comments

Comments
 (0)