Skip to content

Commit dc59524

Browse files
committed
[dotnet] Coercing return type of GetCastSinks() to proper datatype
1 parent 1c817b5 commit dc59524

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

dotnet/src/webdriver/Chromium/ChromiumDriver.cs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,30 @@ public void CloseDevToolsSession()
287287
/// <summary>
288288
/// Returns the list of cast sinks (Cast devices) available to the Chrome media router.
289289
/// </summary>
290-
/// <returns>An object representing the list of available sinks.</returns>
291-
public object GetCastSinks()
290+
/// <returns>The list of available sinks.</returns>
291+
public List<Dictionary<string, string>> GetCastSinks()
292292
{
293+
List<Dictionary<string, string>> returnValue = new List<Dictionary<string, string>>();
293294
Response response = this.Execute(GetCastSinksCommand, null);
294-
return response.Value;
295+
object[] responseValue = response.Value as object[];
296+
if (responseValue != null)
297+
{
298+
foreach (object entry in responseValue)
299+
{
300+
Dictionary<string, object> entryValue = entry as Dictionary<string, object>;
301+
if (entryValue != null)
302+
{
303+
Dictionary<string, string> sink = new Dictionary<string, string>();
304+
foreach (KeyValuePair<string, object> pair in entryValue)
305+
{
306+
sink[pair.Key] = pair.Value.ToString();
307+
}
308+
309+
returnValue.Add(sink);
310+
}
311+
}
312+
}
313+
return returnValue;
295314
}
296315

297316
/// <summary>

0 commit comments

Comments
 (0)