Skip to content

Commit

Permalink
[dotnet] implement ability to launch chromium application
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Sep 29, 2021
1 parent ab6a867 commit 232bd58
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions dotnet/src/webdriver/Chromium/ChromiumDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public abstract class ChromiumDriver : WebDriver, ISupportsLogs, IDevTools
private const string DeleteNetworkConditionsCommand = "deleteNetworkConditions";
private const string SendChromeCommand = "sendChromeCommand";
private const string SendChromeCommandWithResult = "sendChromeCommandWithResult";
private const string LaunchAppCommand = "launchAppCommand";

private readonly string optionsCapabilityName;
private DevToolsSession devToolsSession;
Expand Down Expand Up @@ -81,6 +82,7 @@ public ChromiumDriver(ChromiumDriverService service, ChromiumOptions options, Ti
this.AddCustomChromeCommand(DeleteNetworkConditionsCommand, HttpCommandInfo.DeleteCommand, "/session/{sessionId}/chromium/network_conditions");
this.AddCustomChromeCommand(SendChromeCommand, HttpCommandInfo.PostCommand, "/session/{sessionId}/chromium/send_command");
this.AddCustomChromeCommand(SendChromeCommandWithResult, HttpCommandInfo.PostCommand, "/session/{sessionId}/chromium/send_command_and_get_result");
this.AddCustomChromeCommand(LaunchAppCommand, HttpCommandInfo.PostCommand, "/session/{sessionId}/chromium/launch_app");
}

/// <summary>
Expand Down Expand Up @@ -133,6 +135,22 @@ public ChromiumNetworkConditions NetworkConditions
}
}

/// <summary>
/// Launches a Chromium based application.
/// </summary>
/// <param name="id">ID of the chromium app to launch.</param>
public void LaunchApp(string id)
{
if (id == null)
{
throw new ArgumentNullException("id", "id must not be null");
}

Dictionary<string, object> parameters = new Dictionary<string, object>();
parameters["id"] = id;
this.Execute(LaunchAppCommand, parameters);
}

/// <summary>
/// Executes a custom Chrome Dev Tools Protocol Command.
/// </summary>
Expand Down

0 comments on commit 232bd58

Please sign in to comment.