Reputation: 143
I have piece of code
object Items = (object)js.ExecuteScript("return angular.element(document.getElementById('bank-list')).scope().items");
If I try to use Console.WriteLine(Items);
It outputsSystem.Collections.ObjectModel.ReadOnlyCollection1[System.Object]
My question is: How I could get the data from the object?
Data which should be in the Items
variable is something like:
[{"index": 383, "id": 12163, "count": 1676, "formattedCount": 1676}]
Upvotes: 0
Views: 1202
Reputation: 169320
Try this:
var items = js.ExecuteScript("return angular.element(document.getElementById('bank-list')).scope().items") as ReadOnlyCollection<object>;
if(items != null)
{
foreach (obj obj in items)
{
Dictionary<string,object> dict = obj as Dictionary<string, object>;
if (dict != null)
{
foreach(var val in dict.Values)
Console.WriteLine(val);
}
}
}
Upvotes: 1