Skip to content

Commit 1b0045c

Browse files
committed
[dotnet] add support for casting desktop
1 parent 0c94508 commit 1b0045c

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

‎dotnet/src/webdriver/Chrome/ChromeDriver.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public class ChromeDriver : ChromiumDriver
6565
{ GetCastSinksCommand, new HttpCommandInfo(HttpCommandInfo.GetCommand, "/session/{sessionId}/goog/cast/get_sinks") },
6666
{ SelectCastSinkCommand, new HttpCommandInfo(HttpCommandInfo.PostCommand, "/session/{sessionId}/goog/cast/set_sink_to_use") },
6767
{ StartCastTabMirroringCommand, new HttpCommandInfo(HttpCommandInfo.PostCommand, "/session/{sessionId}/goog/cast/start_tab_mirroring") },
68+
{ StartCastDesktopMirroringCommand, new HttpCommandInfo(HttpCommandInfo.PostCommand, "/session/{sessionId}/goog/cast/start_desktop_mirroring") },
6869
{ GetCastIssueMessageCommand, new HttpCommandInfo(HttpCommandInfo.GetCommand, "/session/{sessionId}/goog/cast/get_issue_message") },
6970
{ StopCastingCommand, new HttpCommandInfo(HttpCommandInfo.PostCommand, "/session/{sessionId}/goog/cast/stop_casting") }
7071
};

‎dotnet/src/webdriver/Chromium/ChromiumDriver.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ public class ChromiumDriver : WebDriver, ISupportsLogs, IDevTools
5454
/// </summary>
5555
public static readonly string StartCastTabMirroringCommand = "startCastTabMirroring";
5656

57+
/// <summary>
58+
/// Command for starting cast desktop mirroring in a driver for a Chromium-based browser.
59+
/// </summary>
60+
public static readonly string StartCastDesktopMirroringCommand = "startCastDesktopMirroring";
61+
5762
/// <summary>
5863
/// Command for getting a cast issued message in a driver for a Chromium-based browser.
5964
/// </summary>
@@ -393,6 +398,22 @@ public void StartTabMirroring(string deviceName)
393398
this.Execute(StartCastTabMirroringCommand, parameters);
394399
}
395400

401+
/// <summary>
402+
/// Initiates mirroring of the desktop on the specified device.
403+
/// </summary>
404+
/// <param name="deviceName">Name of the target sink (device).</param>
405+
public void StartDesktopMirroring(string deviceName)
406+
{
407+
if (deviceName == null)
408+
{
409+
throw new ArgumentNullException(nameof(deviceName), "deviceName must not be null");
410+
}
411+
412+
Dictionary<string, object> parameters = new Dictionary<string, object>();
413+
parameters["sinkName"] = deviceName;
414+
this.Execute(StartCastDesktopMirroringCommand, parameters);
415+
}
416+
396417
/// <summary>
397418
/// Returns the error message if there is any issue in a Cast session.
398419
/// </summary>

‎dotnet/src/webdriver/Edge/EdgeDriver.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public class EdgeDriver : ChromiumDriver
3535
{ GetCastSinksCommand, new HttpCommandInfo(HttpCommandInfo.GetCommand, "/session/{sessionId}/ms/cast/get_sinks") },
3636
{ SelectCastSinkCommand, new HttpCommandInfo(HttpCommandInfo.PostCommand, "/session/{sessionId}/ms/cast/set_sink_to_use") },
3737
{ StartCastTabMirroringCommand, new HttpCommandInfo(HttpCommandInfo.PostCommand, "/session/{sessionId}/ms/cast/start_tab_mirroring") },
38+
{ StartCastDesktopMirroringCommand, new HttpCommandInfo(HttpCommandInfo.PostCommand, "/session/{sessionId}/ms/cast/start_desktop_mirroring") },
3839
{ GetCastIssueMessageCommand, new HttpCommandInfo(HttpCommandInfo.GetCommand, "/session/{sessionId}/ms/cast/get_issue_message") },
3940
{ StopCastingCommand, new HttpCommandInfo(HttpCommandInfo.PostCommand, "/session/{sessionId}/ms/cast/stop_casting") }
4041
};

0 commit comments

Comments
 (0)