What is proper way to get javascript object by Selenium webdriver in c# -
i have javascript object following
var jsobj = { x: ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], y: [[29.9, 71.5, 106.4, 129.2, 144, 176, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4], [24, 70, 19, 128, 148, 178, 131, 140, 211, 190, 91, 50]], yname: ["mon-data", "mon-data2"] }
i object selenium webdriver in console application
ijavascriptexecutor js = webbrowser1 ijavascriptexecutor; string scp = "return window.jsobj ;"; var obj = (object)js.executescript(scp);
i got object , have tried put value of object array following
string[] xaxis=obj.x; string[] name=obj.yname; double[][] yaxis = obj.y;
i have tried looping through obj got error. proper way handle kind of object in c#?
call object ienumerable. allow use loop\foreach etc.
foreach (var o in obj ienumerable) { console.writeline(o); }
Comments
Post a Comment