title: Alternative ways for selecting value from drop down list in selenium using java
body: <p>I have got an error with select the value from drop down list in selenium using java. </p>
  
  <pre><code>//Select the Warehouse
  Select Warehouse= new Select(driver.findElement(By.xpath(Xpath.warehouse_SVR)));
  System.out.println("Element is identified ");
  Warehouse.selectByValue("3");
  System.out.println("Value is selected");
  Thread.sleep(1000);
  js.executeScript("window.scrollTo(0,0)");
  </code></pre>
  
  <p>I used the methods which are related to select the value from drop down list. Here I mentioned the .selectByValue() method. Even though I used .selectByIndex() or .selectByVisibleText() methods, still  I have got the error. What is the possible way to select the value from drop down list?</p>
  
  <p>This is the Html code for that particular drop down list.</p>
  
  <pre><code>&lt;select id="ctl00_cphbody_rptRNDViewer_ctl04_ctl05_ddValue" class="aspNetDisabled" style="font-family: Verdana; font-size: 8pt; width: 217px;" onchange="javascript:setTimeout('__doPostBack(\'ctl00$cphbody$rptRNDViewer$ctl04$ctl05$ddValue\',\'\')', 0)" name="ctl00$cphbody$rptRNDViewer$ctl04$ctl05$ddValue"&gt;
  &lt;option value="1"&gt;- All -&lt;/option&gt;
  &lt;option value="2"&gt;Damage Warehouse-1000003061&lt;/option&gt;
  &lt;option value="3" selected="selected"&gt;Primary Warehouse-1000003061&lt;/option&gt;
  &lt;option value="4"&gt;VAN&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>