title: Not able to change radio button value in webdriver
body: <p>In this html code, cash is selected as default and I want to change radio value as card.</p>
  
  <pre><code>&lt;label&gt;
      &lt;input id="cash" type="radio" checked="" value="CS" name="cash_cash"&gt;
      &lt;i&gt;&lt;/i&gt;CASH
  &lt;/label&gt;
  &lt;label&gt;
      &lt;input id="card" type="radio" value="CD" name="cash_cash"&gt;
      &lt;i&gt;&lt;/i&gt;Card
  &lt;/label&gt;
  </code></pre>
  
  <p>I have used below codes, none of them gave me results.</p>
  
  <p>METHOD 1</p>
  
  <pre><code>WebElement pl=driver.findElement(By.xpath("//input[@name='cash_cash'and @value='card']"));
  pl.click();
  </code></pre>
  
  <p>METHOD 2</p>
  
  <pre><code>List&lt;WebElement&gt; radiobuttons = driver.findElements(By.id("card"));
  for(WebElement radio:radiobuttons)
  {
      String cvalue = radio.getAttribute("value");
      if(cvalue .equals("CD"))
      {
          radio.click();
      }
      else
      {
          System.out.println("fails");
      }
  }
  
  int rcount = radiobuttons.size();
  </code></pre>
  
  <p>Above line gives me <code>rcount</code> as 4 although there are only two options.</p>
  
  <p>please help me with this (its a pop-up).
  <a href="http://i.stack.imgur.com/lJw9l.png" rel="nofollow">HTML source</a></p>