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

ShouldReturnTheValueOfSelectedForRadioButtonsEvenIfTheyLackThatAttribute() private méthode

        public void ShouldReturnTheValueOfSelectedForRadioButtonsEvenIfTheyLackThatAttribute()
        {
            driver.Url = formsPage;
            IWebElement neverSelected = driver.FindElement(By.Id("cheese"));
            IWebElement initiallyNotSelected = driver.FindElement(By.Id("peas"));
            IWebElement initiallySelected = driver.FindElement(By.Id("cheese_and_peas"));

            Assert.AreEqual(null, neverSelected.GetAttribute("selected"), "false");
            Assert.AreEqual(null, initiallyNotSelected.GetAttribute("selected"), "false");
            Assert.AreEqual("true", initiallySelected.GetAttribute("selected"), "true");

            initiallyNotSelected.Click();
            Assert.AreEqual(null, neverSelected.GetAttribute("selected"));
            Assert.AreEqual("true", initiallyNotSelected.GetAttribute("selected"));
            Assert.AreEqual(null, initiallySelected.GetAttribute("selected"));
        }