title: Use selenium WebDriver to select radio button from text
body: <p>We've got some poorly written radio buttons on a legacy page as follows:</p>
  
  <pre><code>&lt;input id="button1" name="button" value="32" onchange="assignProduct(this.value);" type="radio"&gt;&lt;/input&gt;
  RADIO TEXT 1
  &lt;input id="button2" name="button" value="33" onchange="assignProduct(this.value);" type="radio"&gt;&lt;/input&gt;
  RADIO TEXT 2
  </code></pre>
  
  <p>for information, this displays the same as would:</p>
  
  <pre><code>&lt;input id="button" name="button" value="32" onchange="assignProduct(this.value);" type="radio"&gt;RADIO TEXT 1&lt;/input&gt;
  &lt;input id="button" name="button" value="33" onchange="assignProduct(this.value);" type="radio"&gt;RADIO TEXT 2&lt;/input&gt;
  </code></pre>
  
  <p>The latter code is more correct and allows selection of input button by text "RADIO TEXT 2" by:</p>
  
  <pre><code>driver.findElement(By.xpath("(//input[contains(@text, 'RADIO TEXT 2')])")).click();
  </code></pre>
  
  <p>What code can I use to find the radio button in the first code sample, which is what I actually have to deal with?  </p>
  
  <p>The text is no longer contained within the  element so .xpath() doesn't match it.</p>
  
  <p>I need to find the text, then click the input immediately prior? Can I do this without consuming and traversing the entire page?</p>