Exemple #1
0
 public static NativeMessagingMessageTab updatetab(string browser, NativeMessagingMessageTab tab)
 {
     if (browser == "chrome")
     {
         if (chromeconnected)
         {
             return(chromeupdatetab(tab));
         }
     }
     else if (browser == "edge")
     {
         if (edgeconnected)
         {
             return(edgeupdatetab(tab));
         }
     }
     else
     {
         if (ffconnected)
         {
             return(ffupdatetab(tab));
         }
     }
     return(null);
 }
Exemple #2
0
        public static object ExecuteScript(string browser, int frameid, int tabid, string script, TimeSpan timeout)
        {
            NativeMessagingMessage    message = new NativeMessagingMessage("executescript", PluginConfig.debug_console_output, PluginConfig.unique_xpath_ids);
            NativeMessagingMessage    result  = null;
            NativeMessagingMessageTab tab     = null;

            if (browser != "chrome" && browser != "ff" && browser != "edge")
            {
                browser = "chrome";
            }
            if (tabid > -1)
            {
                tab = tabs.Where(x => x.id == tabid && x.browser == browser).FirstOrDefault();
            }
            if (tab == null)
            {
                if (browser == "chrome")
                {
                    tab = CurrentChromeTab;
                }
                if (browser == "ff")
                {
                    tab = CurrentFFTab;
                }
            }
            message.tab     = tab; message.windowId = tab.windowId; message.tabid = tab.id;
            message.browser = browser; message.frameId = frameid;
            message.script  = script;
            result          = sendMessageResult(message, false, timeout);
            if (result != null)
            {
                return(result.result);
            }
            return(null);
        }
Exemple #3
0
 public static void HighlightTab(NativeMessagingMessageTab tab)
 {
     if (!tab.highlighted)
     {
         tab.highlighted = true;
         UpdateTab(tab);
     }
 }
Exemple #4
0
        internal static NativeMessagingMessageTab edgeupdatetab(NativeMessagingMessageTab tab)
        {
            NativeMessagingMessage message = new NativeMessagingMessage("updatetab", PluginConfig.debug_console_output, PluginConfig.unique_xpath_ids)
            {
                tabid = tab.id, tab = tab
            };
            NativeMessagingMessage result = edgepipe.Message(message, true, TimeSpan.FromSeconds(2));

            WaitForTab(result.tabid, result.browser, TimeSpan.FromSeconds(5));
            return(tabs.Where(x => x.browser == "edge" && x.id == tab.id).FirstOrDefault());
        }
Exemple #5
0
        public static void CloseTab(NativeMessagingMessageTab tab)
        {
            NativeMessagingMessage message = new NativeMessagingMessage("closetab", PluginConfig.debug_console_output, PluginConfig.unique_xpath_ids);
            NativeMessagingMessage result  = null;

            message.browser  = tab.browser; message.tabid = tab.id; message.tab = tab;
            message.windowId = tab.windowId;
            if (connected)
            {
                result = sendMessageResult(message, true, TimeSpan.FromSeconds(2));
            }
        }
Exemple #6
0
        public static void CloseTab(NativeMessagingMessageTab tab)
        {
            NativeMessagingMessage message = new NativeMessagingMessage("closetab");
            NativeMessagingMessage result  = null;

            message.browser  = tab.browser; message.tabid = tab.id; message.tab = tab;
            message.windowId = tab.windowId;
            if (connected)
            {
                result = sendMessageResult(message, true, TimeSpan.FromSeconds(2));
            }
        }
Exemple #7
0
        public static void UpdateTab(NativeMessagingMessageTab tab)
        {
            NativeMessagingMessage message = new NativeMessagingMessage("updatetab");
            NativeMessagingMessage result  = null;

            message.browser  = tab.browser; message.tabid = tab.id; message.tab = tab;
            message.windowId = tab.windowId;
            if (connected)
            {
                result = sendMessageResult(message, true);
                WaitForTab(result.tabid, result.browser, TimeSpan.FromSeconds(5));
            }
        }