Esempio n. 1
0
        protected virtual void WaitForFramesToComplete(IHTMLDocument2 maindocument)
        {
            var mainHtmlDocument = (HTMLDocument)maindocument;

            var framesCount = FrameCountProcessor.GetFrameCountFromHTMLDocument(mainHtmlDocument);

            for (var i = 0; i != framesCount; ++i)
            {
                var frame = FrameByIndexProcessor.GetFrameFromHTMLDocument(i, mainHtmlDocument);

                if (frame == null)
                {
                    continue;
                }

                IHTMLDocument2 document;

                try
                {
                    WaitWhileIEBusy(frame);
                    WaitWhileIEReadyStateNotComplete(frame);
                    WaitWhileFrameDocumentNotAvailable(frame);

                    document = (IHTMLDocument2)frame.Document;
                }
                finally
                {
                    // free frame
                    Marshal.ReleaseComObject(frame);
                }

                WaitWhileDocumentStateNotComplete(document);
                WaitForFramesToComplete(document);
            }
        }
        public static IWebBrowser2 GetFrameFromHTMLDocument(int frameIndex, HTMLDocument htmlDocument)
        {
            var processor = new FrameByIndexProcessor(frameIndex, htmlDocument);

            IEUtils.EnumIWebBrowser2Interfaces(processor);

            return(processor.IWebBrowser2());
        }
Esempio n. 3
0
        private string RetrieveUniqueIdOfFrameElement()
        {
            var frame = _iFrameElements.length == 0 ?
                        FrameByIndexProcessor.GetFrameFromHTMLDocument(_index, _htmlDocument) :
                        _iFrameElements.item(_index, null);

            return(new Expando(frame).GetValue <string>("uniqueID"));
        }
        internal static IWebBrowser2 GetFrameFromHTMLDocument(int frameIndex, HTMLDocument htmlDocument)
        {
            var processor = new FrameByIndexProcessor(frameIndex, htmlDocument);

            IEUtils.EnumIWebBrowser2Interfaces(processor);

            return processor.IWebBrowser2();
        }
Esempio n. 5
0
        public virtual void WaitForFramesToComplete(IHTMLDocument2 maindocument)
        {
            var mainHtmlDocument = UtilityClass.GetWithFailOver(() => (HTMLDocument)maindocument);

            var framesCount = FrameCountProcessor.GetFrameCountFromHTMLDocument(mainHtmlDocument);

            for (var i = 0; i != framesCount; ++i)
            {
                var frame = FrameByIndexProcessor.GetFrameFromHTMLDocument(i, mainHtmlDocument);

                if (frame == null)
                {
                    continue;
                }

                IHTMLDocument2 frameDocument;
                try
                {
                    if (!WaitWhileIEBusy(frame))
                    {
                        continue;
                    }

                    if (!WaitWhileIEReadyStateNotComplete(frame))
                    {
                        continue;
                    }

                    WaitWhileFrameDocumentNotAvailable(frame);

                    frameDocument = (IHTMLDocument2)frame.Document;
                }
                finally
                {
                    // free frame
                    Marshal.ReleaseComObject(frame);
                }

                WaitWhileDocumentStateNotCompleteOrInteractive(frameDocument);
                WaitForFramesToComplete(frameDocument);
            }
        }