title: Selenium WebDriver and xpath: a more complicated selection
body: <p>So let's say my structure looks like this at some point:</p>
  
  <pre><code>..........
  &lt;td&gt;
    [...]
    &lt;input value="abcabc"&gt;
    [...]
  &lt;/td&gt;
  [...]
  &lt;td&gt;&lt;/td&gt;
  [...]
  &lt;td&gt;
    &lt;input id="booboobooboo01"&gt;
    &lt;div&gt;&lt;/div&gt; &lt;=======I want to click this!
  &lt;/td&gt;
  .........
  </code></pre>
  
  <p>I need to click that div, but I need to be sure it's on the same line as the td containing the input with <code>value="abcabc"</code>. I also know that the div I need to click (which doesn't have id or any other relevant attribute I can use) is in a td at the same level as the first td, right after the input with id CONTAINING "boo" (dynamically generated, I only know the root part of the id). td's contain nothing relevant I can use.
  This is what I tried as far as xpath goes:</p>
  
  <pre><code>//input[@value='abcabc']/../td/input[contains(@id,'boo')]/following-sibling::div
  
  //input[@value='abcabc']/..//td/input[contains(@id,'boo')]/following-sibling::div
  </code></pre>
  
  <p>None of them worked, of course (element cannot be found).
  I want to know if there's a way of selecting that div and how.</p>
  
  <p><strong>EDIT: <code>//input[@value='abcabc']/../../td/input[contains(@id,'boo')]/following-sibling::div</code> is the correct way. This was suggested by the person with the accepted answer. Also note that he offered a slightly different way of doing it. See his answer for details.</strong></p>