public override string ExecJavascript(string js)
{
// There is a bug in several versions of the android api affecting the call to execute js in a webview
// Because of this we execute the js as a url, and write to the console with a unique prefix to get the output back
Chrome.ClearConsole();
Url = string.Format("javascript:window.console.debug('{0}' + eval(\"{1}\"));", AndroidChromeClient.JS_PREFIX, js);
try
{
// This timeout is chosen to be consistent with the equivalent timeout on the iOS side, which is imposed by apple
Chrome.JsTrigger.WaitOne(10000);
}
catch (TimeoutException)
{
throw new TimeoutException(string.Format("Timed out waiting for javascript execution: {0} \n Console:\n{1}", js, Chrome.Console));
}
return Chrome.Return;
}