private static void RunResponseScript(string script) { try { Task.Run(() => { var frame = FrameHandler.GetMainFrame(); if (frame == null) { var errorMsg = $"Cannot get frame to run {script}."; Log.Error(errorMsg); return; } frame.ExecuteJavaScript(script, null, 0); }); } catch (Exception e) { Log.Error(e); } }
private static void RunResponseScriptAsync(string script) { try { Task.Run(async() => { var frame = FrameHandler.GetMainFrame(); if (frame == null) { var errorMsg = $"Cannot get frame to run {script}."; Log.Error(errorMsg); return; } await frame.EvaluateScriptAsync(script).ConfigureAwait(false); }); } catch (Exception e) { Log.Error(e); } }