예제 #1
0
        public void DeselectDropdownValueByValueIndexTest()
        {
            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']"), "BMW");
            Assert.AreEqual("BMW", elementActions.GetSelectedOption(By.XPath("//select[@name='cars']")).Text, "The selected dropdown values didn't match.");
            elementActions.DeselectDropdownValueByIndex(Driver.FindElement(By.XPath("//select[@name='cars']")), 2);
            Assert.IsNull(elementActions.GetSelectedOption(By.XPath("//select[@name='cars']")), "The selected dropdown option wasn't null.");
        }