protected override void Execute(NativeActivityContext context) { var url = Url.Get(context); var browser = Browser.Get(context); var timeout = TimeSpan.FromSeconds(3); var newtab = NewTab.Get(context); if (browser != "chrome" && browser != "ff" && browser != "edge") { browser = "chrome"; } if (!string.IsNullOrEmpty(url)) { NMHook.enumtabs(); var tab = NMHook.tabs.Where(x => x.browser == browser && x.url.ToLower().StartsWith(url.ToLower())).FirstOrDefault(); if (tab != null) { if (!tab.highlighted || !tab.selected) { var _tab = NMHook.selecttab(browser, tab.id); } } } NMHook.openurl(browser, url, newtab); }
protected override void Execute(NativeActivityContext context) { var url = Url.Get(context); var browser = Browser.Get(context); var timeout = TimeSpan.FromSeconds(3); var newtab = NewTab.Get(context); if (browser != "chrome" && browser != "ff" && browser != "edge") { browser = "chrome"; } if (!string.IsNullOrEmpty(url)) { NMHook.enumtabs(); var tab = NMHook.FindTabByURL(browser, url); if (tab != null) { if (!tab.highlighted || !tab.selected) { var _tab = NMHook.selecttab(browser, tab.id); } } } NMHook.openurl(browser, url, newtab); }
protected override void Execute(NativeActivityContext context) { var url = Url.Get(context); var browser = Browser.Get(context); var timeout = TimeSpan.FromSeconds(3); if (browser != "chrome" && browser != "ff") { browser = "chrome"; } NMHook.openurl(browser, url); }
public IElement LaunchBySelector(Selector selector, bool CheckRunning, TimeSpan timeout) { var first = selector[0]; var second = selector[1]; var p = first.Properties.Where(x => x.Name == "browser").FirstOrDefault(); string browser = ""; if (p != null) { browser = p.Value; } p = first.Properties.Where(x => x.Name == "url").FirstOrDefault(); string url = ""; if (p != null) { url = p.Value; } NMHook.openurl(browser, url); if (browser == "chrome") { foreach (var process in System.Diagnostics.Process.GetProcesses()) { string pname = process.ProcessName.ToLower(); if (pname.Contains("chrome")) { string title = process.MainWindowTitle; Console.WriteLine(title); if (!string.IsNullOrEmpty(title)) { var exists = NMHook.tabs.Where(x => x.title == title).FirstOrDefault(); var automation = AutomationUtil.getAutomation(); var _ele = automation.FromHandle(process.MainWindowHandle); return(new UIElement(_ele)); } } } } return(null); }
public void LaunchBySelector(Selector selector, TimeSpan timeout) { var first = selector[0]; var second = selector[1]; var p = first.Properties.Where(x => x.Name == "browser").FirstOrDefault(); string browser = ""; if (p != null) { browser = p.Value; } p = first.Properties.Where(x => x.Name == "url").FirstOrDefault(); string url = ""; if (p != null) { url = p.Value; } NMHook.openurl(browser, url); }
protected override void Execute(NativeActivityContext context) { var url = Url.Get(context); var browser = Browser.Get(context); var timeout = TimeSpan.FromSeconds(3); var newtab = NewTab.Get(context); if (browser != "chrome" && browser != "ff" && browser != "edge") { browser = "chrome"; } if (!string.IsNullOrEmpty(url)) { NMHook.enumtabs(); var tab = NMHook.FindTabByURL(browser, url); if (tab != null) { if (!tab.highlighted || !tab.selected) { var _tab = NMHook.selecttab(browser, tab.id); } } } var userDataFolderMode = UserDataFolderMode.Get(context); var userDataFolderPath = UserDataFolderPath.Get(context); string profilepath = ""; string profilename = ""; if (string.IsNullOrEmpty(userDataFolderMode)) { userDataFolderMode = "automatic"; } userDataFolderMode = userDataFolderMode.ToLower(); if (userDataFolderMode == "automatic") // child session uses a different folder than the default mode, automatically generated if UserDataFolderPath is not set { if (Plugin.client.isRunningInChildSession) { profilepath = userDataFolderPath; if (string.IsNullOrEmpty(profilepath)) { profilepath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\openrpa\\ChildSession\\" + browser; profilename = "ChildSession"; } } } else if (userDataFolderMode == "customfolder") { profilepath = userDataFolderPath; if (string.IsNullOrEmpty(profilepath)) { if (Plugin.client.isRunningInChildSession) { profilepath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\openrpa\\ChildSession\\" + browser; profilename = "ChildSession"; } else { profilepath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\openrpa\\" + browser; profilename = "openrpa"; } } } else if (userDataFolderMode == "defaultfolder") { // Uses the default browser folder, no matter what } NMHook.openurl(browser, url, newtab, profilename, profilepath); }