示例#1
0
        protected virtual TestIEDocument[] GetFrames(TestIEDocument root)
        {
            if (root != null)
            {
                IHTMLDocument doc = root.Document;
                if (doc != null)
                {
                    IHTMLDocument[] frames = COMUtil.GetFrames(doc);
                    if (frames != null && frames.Length > 0)
                    {
                        List <TestIEDocument> framesDocs = new List <TestIEDocument>();
                        foreach (IHTMLDocument frame in frames)
                        {
                            try
                            {
                                TestIEDocument frameDoc = new TestIEDocument(frame as IHTMLDocument2);
                                framesDocs.Add(frameDoc);
                            }
                            catch
                            {
                            }
                        }

                        return(framesDocs.ToArray());
                    }
                }
            }

            return(null);
        }
示例#2
0
        protected virtual TestIEDocument[] GetFrames(TestIEDocument root)
        {
            if (root != null)
            {
                List <TestIEDocument> allDocs = new List <TestIEDocument>();
                allDocs.Add(root);

                TestIEDocument[] frames = root.GetFrames() as TestIEDocument[];
                if (frames != null && frames.Length > 0)
                {
                    foreach (TestIEDocument frame in frames)
                    {
                        try
                        {
                            TestIEDocument[] subFrames = GetFrames(frame);
                            allDocs.AddRange(subFrames);
                        }
                        catch
                        {
                        }
                    }
                }

                return(allDocs.ToArray());
            }

            return(null);
        }
示例#3
0
        public ITestDocument GetParent()
        {
            if (this._document != null)
            {
                try
                {
                    IHTMLDocument3 doc3   = this._document as IHTMLDocument3;
                    TestIEDocument parent = new TestIEDocument(doc3.parentDocument);
                    return(parent);
                }
                catch (TestException)
                {
                    throw;
                }
                catch (Exception ex)
                {
                    throw new CannotGetTestDocumentException("Can not get parent document: " + ex.ToString());
                }
            }

            return(null);
        }
示例#4
0
        public TestIEPage(TestInternetExplorer browser, InternetExplorer ie)
        {
            if (browser == null || ie == null)
            {
                throw new CannotGetTestPageException("Browser can not be null.");
            }

            try
            {
                this._browser      = browser;
                this._internalIE   = ie;
                this._rootDocument = new TestIEDocument(ie.Document as IHTMLDocument2);
            }
            catch (TestException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw new CannotGetTestPageException(ex.ToString());
            }
        }