title: XPath:: Get following Sibling
body: <p>I have following HTML Structure: I am trying to build a robust method to extract second color digest element since there will be many of these tag within the DOM.</p>
  
  <pre><code>&lt;table&gt;
    &lt;tbody&gt;
      &lt;tr bgcolor="#AAAAAA"&gt;
      &lt;tr&gt;
      &lt;tr&gt;
      &lt;tr&gt;
      &lt;tr&gt;
        &lt;td&gt;Color Digest &lt;/td&gt;
        &lt;td&gt;AgArAQICGQMVBBwTIRQHIwg0GUMURAZTBWQJcwV0AoEDAQ &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;Color Digest &lt;/td&gt;
        &lt;td&gt;2,43,2,25,21,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,33,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I am trying to extract the Second "Color Digest" td element that has the decoded value. </p>
  
  <p>I wrote the following xpath but instead of getting the second i am not getting the second td element.</p>
  
  <pre><code>//td[text() = ' Color Digest ']/following-sibling::td[2]
  </code></pre>
  
  <p>And when I change it to td[2] to td[1] I get both the elements.</p>