protected override void Execute(NativeActivityContext context) { var script = Script.Get(context); var frameid = FrameId.Get(context); var browser = Browser.Get(context); var timeout = TimeSpan.FromSeconds(3); script = Interfaces.Selector.Selector.ReplaceVariables(script, context.DataContext); if (browser != "chrome" && browser != "ff" && browser != "edge") { browser = "chrome"; } if (!script.Contains(Environment.NewLine) && !script.Contains(";") && !script.Contains("return")) { script = "return " + script; } var result = NMHook.ExecuteScript(browser, frameid, -1, script, timeout); if (result == null) { result = "[]"; } var results = JsonConvert.DeserializeObject <object[]>(result.ToString()); Result.Set(context, results[0]); Results.Set(context, results); }
protected override void Execute(NativeActivityContext context) { var script = Script.Get(context); var frameid = FrameId.Get(context); var browser = Browser.Get(context); var timeout = TimeSpan.FromSeconds(3); script = Interfaces.Selector.Selector.ReplaceVariables(script, context.DataContext); if (browser != "chrome" && browser != "ff" && browser != "edge") { browser = "chrome"; } var result = NMHook.ExecuteScript(browser, frameid, -1, script, timeout); if (result == null) { result = "[]"; } var results = JsonConvert.DeserializeObject <object[]>(result.ToString()); if (results != null && results.Length > 0) { Result.Set(context, results[0]); } else { Result.Set(context, null); } Results.Set(context, results); }
protected override void Execute(NativeActivityContext context) { var script = Script.Get(context); var frameid = FrameId.Get(context); var browser = Browser.Get(context); var timeout = TimeSpan.FromSeconds(3); script = Interfaces.Selector.Selector.ReplaceVariables(script, context.DataContext); if (browser != "chrome" && browser != "ff" && browser != "edge") { browser = "chrome"; } var result = NMHook.ExecuteScript(browser, frameid, -1, script, timeout); Result.Set(context, result); }