Пример #1
0
        public override UIControlBase[] GetChildren()
        {
            List <UIControlBase> children = new List <UIControlBase>();

            foreach (IE browser in WatiN.Core.IE.InternetExplorers())
            {
                if (browser.NativeDocument != null)
                {
                    children.Add(new WatBrowser(browser));
                }
            }
            FireFox ffBrowser = null;

            try
            {
                ffBrowser = FireFox.AttachTo <FireFox>(WatiN.Core.Constraints.AnyConstraint.Instance, 2);
            }
            catch { }
            if (ffBrowser != null)
            {
                children.Add(new WatBrowser(ffBrowser));
            }

            return(children.ToArray());
        }
Пример #2
0
 public void FireFoxCanAttachByUri()
 {
     using (var fireFox = new FireFox(NewWindowUri))
     {
         fireFox.Links[0].Click();
         var newWindow = FireFox.AttachTo <FireFox>(Find.ByUrl(NewWindowTargetUri));
         Assert.That(newWindow.Text.Trim() == "Welcome to the new window.");
         newWindow.Close();
     }
 }
Пример #3
0
 public void FireFoxCanAttachByTitle()
 {
     Settings.AttachToBrowserTimeOut = 3;
     using (var fireFox = new FireFox(NewWindowUri))
     {
         fireFox.Links[0].Click();
         var newWindow = FireFox.AttachTo <FireFox>(Find.ByTitle("New Window Target Page"));
         Assert.That(newWindow.Text.Trim() == "Welcome to the new window.");
         newWindow.Close();
     }
 }
Пример #4
0
 public void FireFoxCanDisposeAttachedBrowser()
 {
     using (var fireFox = new FireFox(NewWindowUri))
     {
         fireFox.Buttons[0].Click();
         using (var newWindow = FireFox.AttachTo <FireFox>(Find.ByUrl(NewWindowTargetUri)))
         {
             Assert.That(newWindow.ContainsText("Welcome"), Is.True, "Expected 'Welcome'");
         }
         Assert.That(fireFox.Buttons[0].Exists);
     }
 }