title: org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been "select" but was "span" while selecting a dropdown value
body: <p>Here I am trying to select a value from dropdown using selenium script but I got this error in the console like</p>
  
  <blockquote>
    <p>"Exception in thread "main" org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been "select" but was "span"..</p>
  </blockquote>
  
  <pre><code>public class HomeUserManagement {
  
  public static void main(String args[]) {
      System.setProperty("webdriver.chrome.driver", 
  "C:\\Users\\UMASHANKAR\\Documents\\selenuim\\chromedriver.exe");
      WebDriver driver=new ChromeDriver();
      driver.manage().window().maximize();
  
  //for login
      driver.get("https://ecabportal.azurewebsites.net/dashboard");
  
  driver.findElement(By.name("email")).sendKeys("abc@xyz.in");
  
  driver.findElement(By.name("password")).sendKeys("abc123xyz");
      driver.findElement(By.name("signIn")).click();  
  
  
  //actual code for selecting a value from dropdown
  
   driver.get("https://ecabportal.azurewebsites.net/user");
      Select drpdwn=new Select(driver.findElement(By.id("select2-signup-username-container")));
      drpdwn.selectByVisibleText("User Name");
      drpdwn.selectByIndex(0);
  </code></pre>
  
  <p>there are multiple values in a dropdown  I need to select one value in that..</p>