Beispiel #1
0
        public void ShouldBeAbleToFindChildrenOfANode()
        {
            driver.Get(xhtmlTestPage);
            IList      elements = driver.SelectElementsByXPath("/html/head");
            WebElement head     = (WebElement)elements[0];
            IList      scripts  = head.GetChildrenOfType("script");

            Assert.AreEqual(2, scripts.Count);
        }
Beispiel #2
0
        public void ShouldReturnTheValueOfSelectedForOptionsInSelectsEvenIfTheyLackThatAttribute()
        {
            driver.Get(formPage);
            WebElement selectBox = driver.SelectElement("//select[@name='selectomatic']");
            IList      options   = selectBox.GetChildrenOfType("option");
            WebElement one       = (WebElement)options[0];
            WebElement two       = (WebElement)options[1];

            Assert.IsTrue(one.Selected);
            Assert.IsFalse(two.Selected);
            Assert.AreEqual("true", one.GetAttribute("selected"));
            Assert.AreEqual("false", two.GetAttribute("selected"));
        }
Beispiel #3
0
        public void ShouldBeAbleToChangeTheSelectedOptionInASelect()
        {
            driver.Get(formPage);
            WebElement selectBox = driver.SelectElement("//select[@name='selectomatic']");
            IList      options   = selectBox.GetChildrenOfType("option");
            WebElement one       = (WebElement)options[0];
            WebElement two       = (WebElement)options[1];

            Assert.IsTrue(one.Selected);
            Assert.IsFalse(two.Selected);

            two.SetSelected();
            Assert.IsFalse(one.Selected);
            Assert.IsTrue(two.Selected);
        }