Skip to content

Commit

Permalink
[dotnet] Coercing return type of GetCastSinks() to proper datatype
Browse files Browse the repository at this point in the history
  • Loading branch information
jimevans committed Sep 29, 2021
1 parent 1c817b5 commit dc59524
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions dotnet/src/webdriver/Chromium/ChromiumDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,30 @@ public void CloseDevToolsSession()
/// <summary>
/// Returns the list of cast sinks (Cast devices) available to the Chrome media router.
/// </summary>
/// <returns>An object representing the list of available sinks.</returns>
public object GetCastSinks()
/// <returns>The list of available sinks.</returns>
public List<Dictionary<string, string>> GetCastSinks()
{
List<Dictionary<string, string>> returnValue = new List<Dictionary<string, string>>();
Response response = this.Execute(GetCastSinksCommand, null);
return response.Value;
object[] responseValue = response.Value as object[];
if (responseValue != null)
{
foreach (object entry in responseValue)
{
Dictionary<string, object> entryValue = entry as Dictionary<string, object>;
if (entryValue != null)
{
Dictionary<string, string> sink = new Dictionary<string, string>();
foreach (KeyValuePair<string, object> pair in entryValue)
{
sink[pair.Key] = pair.Value.ToString();
}

returnValue.Add(sink);
}
}
}
return returnValue;
}

/// <summary>
Expand Down

0 comments on commit dc59524

Please sign in to comment.