Esempio n. 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.");
        }
Esempio n. 2
0
        public void GetSelectedOptionIWebElementTest()
        {
            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");
            Assert.AreEqual("Honda", elementActions.GetSelectedOption(Driver.FindElement(By.XPath("//select[@name='cars']"))).Text, "The selected options didn't match.");
        }
Esempio n. 3
0
        public void SelectDropdownValueByIndexIWebElementTest()
        {
            var elementActions = new ElementActions(Driver);

            Driver.Url = "http://the-internet.herokuapp.com/";
            elementActions.Click(Driver.FindElement(By.XPath("//a[text()='Dropdown']")));
            elementActions.SelectDropdownValueByIndex(Driver.FindElement(By.Id("dropdown")), 1);
            Assert.AreEqual("Option 1", elementActions.GetSelectedOption(Driver.FindElement(By.Id("dropdown"))).Text, "The selected dropdown values didn't match.");
        }