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!
objectis an alias forSystem.Objectin C#, so that makes no difference."['aa','bb']"or something else, or nothing at all?string.