OpenQA.Selenium.ElementAttributeTest.ShouldReturnTheValueOfSelectedForOptionsInSelectsEvenIfTheyLackThatAttribute C# (CSharp) Méthode

ShouldReturnTheValueOfSelectedForOptionsInSelectsEvenIfTheyLackThatAttribute() private méthode

        public void ShouldReturnTheValueOfSelectedForOptionsInSelectsEvenIfTheyLackThatAttribute()
        {
            driver.Url = formsPage;
            IWebElement selectBox = driver.FindElement(By.XPath("//select[@name='selectomatic']"));
            ReadOnlyCollection<IWebElement> options = selectBox.FindElements(By.TagName("option"));
            IWebElement one = options[0];
            IWebElement two = options[1];
            Assert.IsTrue(one.Selected);
            Assert.IsFalse(two.Selected);
            Assert.AreEqual("true", one.GetAttribute("selected"));
            Assert.AreEqual(null, two.GetAttribute("selected"));
        }