private void ExecuteJavascriptCommand(string command) { Instance.Invoke(new Action(() => { try { geckoJs.EvaluateScript(command); } catch (Exception e) { Console.WriteLine("Error executing javascript command: " + command + ", Reason: " + e.Message); } })); }
public string JSCall(string script) { string outString = ""; using (var js = new Gecko.AutoJSContext(browser.Window.JSContext)) { try { js.EvaluateScript(script, (Gecko.nsISupports)browser.Window.DomWindow, out outString); } catch (Gecko.GeckoJavaScriptException ex) { System.Console.WriteLine(ex.Message); } catch (System.NotImplementedException ex) { System.Console.WriteLine(ex.Message); } } return(outString); }