Selenium WebDriver Java: not able to select a value from a drop-down list
I'm trying to select an option from a drop-down list, and I'm not able using the common methods of the Select class. I also tried the
selectByValueand same result.
Select oSelect = new Select(driver.findElement(By.xpath("//*[@model='typeOfCover']"))); oSelect.selectByIndex(2); ```
Here is the piece of HTML of this drop-down list. I would thank any help on this.
Your locator seems wrong.
Select menu = new Select(driver.findElement(By.cssSelector("ul.dropdown-menu")))