title: Trouble using parent::* axes in selenium web driver
body: <p>I am trying to use a wildcard to navigate up the DOM in selenium, using something like this...</p>
  
  <pre><code>    ArrayList&lt;WebElement&gt; list = (ArrayList&lt;WebElement&gt;) driver.findElements(By.xpath("//div[contains(text(),'div_text')]/parent::*]"));
  </code></pre>
  
  <p>to try to get all the parent elements of the div that has 'div_text'.  This only seems to return the immediate parent, not ALL the parents.  I need to go a variable number of nodes up the DOM.</p>
  
  <p>Once I get the list, I plan to iterate through with</p>
  
  <pre><code>for(WebElement e: list)
     if(e.getTagName().equals("table") &amp;&amp; e.getAttribute("class").equals("blah")
         e.click();
  </code></pre>
  
  <p>Agreed that this is not the most efficient approach, but more complex xpath expressions like</p>
  
  <pre><code>driver.findElements(By.xpath("//div[text()='title']/[name(parent::*) = 'table'"));
  </code></pre>
  
  <p>do not seem to work in web driver.</p>
  
  <p>Thanks for any insight on this.</p>