'How to solve "org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been "select" but was "input"" selenium error
I'm going to get the default selected value of the below dropdown
I wrote below code to do it.
Select selectyear = new Select(driver.findElement(By.id("year")));
WebElement year = selectyear.getFirstSelectedOption();
String selectedoption = year.getText();
But this throws the following error
org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been "select" but was "input"
How can I fix this? same code is working perfectly for dropdowns that don't have "value" attribute.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


