Example #1
0
        public void DeselectAllIWebElementTest()
        {
            var elementActions = new ElementActions(Driver);

            Driver.Url = "http://automate-apps.com/select-multiple-options-from-a-drop-down-list/";
            elementActions.SelectDropdownValueByText(By.XPath("//select[@name='cars']"), "Honda");
            elementActions.SelectDropdownValueByText(By.XPath("//select[@name='cars']"), "BMW");
            Assert.IsTrue(elementActions.GetAllSelectedOptions(By.XPath("//select[@name='cars']")).Count == 2, "The total selected dropdown options wasn't 2.");
            elementActions.DeselectAll(Driver.FindElement(By.XPath("//select[@name='cars']")));
            Assert.IsTrue(elementActions.GetAllSelectedOptions(By.XPath("//select[@name='cars']")).Count == 0, "The total selected dropdown options wasn't 0.");
        }