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); }
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")); }
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); }