Exemplo n.º 1
0
        public static treeelement[] _GetRootElements(Selector anchor)
        {
            var browser = Browser.GetBrowser();

            if (browser == null)
            {
                Log.Warning("Failed locating an Internet Explore instance");
                return(new treeelement[] { });
            }
            if (anchor != null)
            {
                IESelector ieselector = anchor as IESelector;
                if (ieselector == null)
                {
                    ieselector = new IESelector(anchor.ToString());
                }
                var elements = IESelector.GetElementsWithuiSelector(ieselector, null, 5);
                var result   = new List <treeelement>();
                foreach (var _ele in elements)
                {
                    var e = new IETreeElement(null, true, _ele);
                    result.Add(e);
                }
                return(result.ToArray());
            }
            else
            {
                var e = new IETreeElement(null, true, new IEElement(browser, browser.Document.documentElement));
                return(new treeelement[] { e });
            }
        }
Exemplo n.º 2
0
        public static treeelement[] GetRootElements()
        {
            SHDocVw.ShellWindows shellWindows = new SHDocVw.ShellWindowsClass();
            SHDocVw.WebBrowser   Browser      = null;
            mshtml.HTMLDocument  Document     = null;
            foreach (SHDocVw.InternetExplorer _ie in shellWindows)
            {
                var filename = System.IO.Path.GetFileNameWithoutExtension(_ie.FullName).ToLower();

                if (filename.Equals("iexplore"))
                {
                    //Debug.WriteLine("Web Site   : {0}", _ie.LocationURL);
                    try
                    {
                        Browser  = _ie as SHDocVw.WebBrowser;
                        Document = (Browser.Document as mshtml.HTMLDocument);
                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex, "");
                    }
                }
            }
            if (Document == null)
            {
                Log.Warning("Failed locating an Internet Explore instance");
                return(new treeelement[] { });
            }

            var e = new IETreeElement(null, true, new IEElement(Document.documentElement));

            return(new treeelement[] { e });
        }