OpenQA.Selenium.SelectElementHandlingTest.ShouldBePossibleToDeselectASingleOptionFromASelectWhichAllowsMultipleChoices C# (CSharp) Méthode

ShouldBePossibleToDeselectASingleOptionFromASelectWhichAllowsMultipleChoices() private méthode

        public void ShouldBePossibleToDeselectASingleOptionFromASelectWhichAllowsMultipleChoices()
        {
            driver.Url = formsPage;

            IWebElement multiSelect = driver.FindElement(By.Id("multi"));
            ReadOnlyCollection<IWebElement> options = multiSelect.FindElements(By.TagName("option"));

            IWebElement option = options[0];
            Assert.IsTrue(option.Selected);
            option.Click();
            Assert.IsFalse(option.Selected);
            option.Click();
            Assert.IsTrue(option.Selected);

            option = options[2];
            Assert.IsTrue(option.Selected);
        }