title: xpath - how can I select the checkbox based on the text before it
body: <p>I have text that says 'Roles'.  After that there are two checkboxes.<br>
  I can get to 'Roles'.<br>
  How can I get to and click check the checkboxes?</p>
  
  <p>I am trying to use:</p>
  
  <pre><code>xpath=(//label[contains(text(),'Roles')]/div/span/input)
  </code></pre>
  
  <p>but getting not found.</p>
  
  <p>My HTML is:</p>
  
  <pre><code>&lt;div class="control-group string required"&gt;
    &lt;label class="string required control-label" for="survey_name"&gt;
    &lt;abbr title="required"&gt;*&lt;/abbr&gt; Name&lt;/label&gt;
    &lt;div class="controls"&gt;
      &lt;input class="string required" id="survey_name" name="survey[name]" size="50" type="text" /&gt;&lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="control-group check_boxes required"&gt;
      &lt;label class="check_boxes required control-label"&gt;
        &lt;abbr title="required"&gt;*&lt;/abbr&gt; Roles
      &lt;/label&gt;
      &lt;div class="controls"&gt;
        &lt;span class="checkbox"&gt;
          &lt;input class="check_boxes required" id="survey_role_ids_121" name="survey[role_ids][]" type="checkbox" value="121" /&gt;
        &lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>