title: Selenium - Not able to select option from drop down
body: <p>Following is the code:</p>
  
  <pre><code>public static void test1() {  
  System.out.print("\nTo find UserName element");
  Select select = new Select(driver.findElement(By.id("drop_down")));
  System.out.print("\nElements found");
  select.selectByIndex(1);
  }
  </code></pre>
  
  <p>Neither following wroks:   </p>
  
  <pre><code>select.selectByIndex(1);
  select.selectByValue("1");
  select.selectByVisibleText("Super Admin"); 
  </code></pre>
  
  <p>It throws an exception:
  Exception in thread "main" org.openqa.selenium.NoSuchElementException: Cannot locate option with value: 1</p>
  
  <pre><code>&lt;select id="drop_down" style="width:205px;" name="drop_down"&gt;
      &lt;option value=""&gt;&lt;/option&gt;
      &lt;option value="1"&gt;
          Super Admin
      &lt;/option&gt;
      &lt;option value="4"&gt;
          Question Reviewer
      &lt;/option&gt;
      &lt;option value="6"&gt;
      Evaluator
      &lt;/option&gt;
  &lt;/select&gt;
  </code></pre>