title: How to select a value from input type dropdown using selenium webdriver?
body: <p>I am trying to select a value available in a read only drop down and I have tried so many options but still failing to select the desired option. The drop down has two values available ValueOne and ValueTwo. By default the ValueOne is selected and in my case I need to select ValueTwo. I used firebug to get the below code when I click on the drop down and do Inspect Element with firebug
  The Code is :</p>
  
  <pre><code>&lt;td class="rcbInputCell rcbInputCellLeft" style="width:100%;"&gt;
  &lt;input id="ctl00_ContentPlaceHolder1_RadGrid1_ctl00_ctl02_ctl02_EditFormControl_rcbControllerType1_Input" class="rcbInput radPreventDecorate" type="text" readonly="readonly" value="ValueOne" name="ctl00$ContentPlaceHolder1$RadGrid1$ctl00$ctl02$ctl02$EditFormControl$rcbControllerType1" autocomplete="off"&gt;
  &lt;/td&gt;
  </code></pre>
  
  <p>So far I have tried </p>
  
  <p>1----------</p>
  
  <pre><code>Select DropDown = new Select(driver.findElement(By.id("ctl00_ContentPlaceHolder1_RadGrid1_ctl00_ctl02_ctl02_EditFormControl_rcbControllerType1_Input")));
          DropDown.selectByVisibleText("ValueTwo");
  </code></pre>
  
  <p>and I get an exception as </p>
  
  <pre><code>:org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been "select" but was "input"
  </code></pre>
  
  <p>2------------</p>
  
  <pre><code>WebElement Dropdown = driver.findElement(By.id("ctl00_ContentPlaceHolder1_RadGrid1_ctl00_ctl02_ctl02_EditFormControl_rcbControllerType1_Input"));
          Select clickThis = new Select (Dropdown);
          clickThis.selectByVisibleText("ValueTwo");
  </code></pre>
  
  <p>Get Exception: </p>
  
  <pre><code>org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been "select" but was "input"
  </code></pre>
  
  <p>I also tried selectByIndex but still get the above exception message.</p>
  
  <p>3--------------</p>
  
  <pre><code>driver.findElement(By.id("ctl00_ContentPlaceHolder1_RadGrid1_ctl00_ctl02_ctl02_EditFormControl_rcbControllerType1_Input")).sendKeys("ValueTwo");
  </code></pre>
  
  <p>Nothing happens and the case is marked as Pass. No error no exception.</p>
  
  <p>Also I am running my <strong>webscript</strong> on <strong>firefox 38.0.5</strong> with <strong>selenium 2.46.0 with eclipse TestNG</strong>.
  I have confirmed the frame is not an iframe.</p>
  
  <p>Please suggest the solution.</p>