Although returning a string is cake, I just can't figure out how to return an array, this is an example that does not work (myURLs is a global array variable):
List<object> list = ((IJavaScriptExecutor)driver).ExecuteScript(
"window.myURLs = ['aa']; window.myURLs.push('bb'); return window.myURLs"
) as List<object>;
The error is: Object reference not set to an instance of an object.
If anyone has an example of returning an array I would love to see it!
object
is an alias forSystem.Object
in C#, so that makes no difference. – Joe Enos Sep 26 '12 at 23:50"['aa','bb']"
or something else, or nothing at all? – Joe Enos Sep 26 '12 at 23:51string
. – Joe Enos Sep 26 '12 at 23:51