title: Java. Selenium webdriver. Get cell value from table
body: <p>Here's a piece of my html</p>
  
  <pre><code>&lt;table class="table_results data ajax" data-uniqueId="20605"&gt;
    &lt;thead&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
      &lt;tr class="odd"&gt;
       &lt;td data-decimals="0" data-type="int" class="right data  not_null  nowrap"&gt;1&lt;/td&gt;
       &lt;td data-decimals="0" data-type="string" data-originallength="5" class="data  not_null   text "&gt;user1&lt;/td&gt;
       &lt;td data-decimals="0" data-type="string" data-originallength="40" class="data  not_null   text "&gt;e38ad214943daad1d64c102faec29de4afe9da3d&lt;/td&gt;
       &lt;td data-decimals="0" data-type="string" data-originallength="14" class="data  not_null   text "&gt;user1@mail.com&lt;/td&gt;
       &lt;td data-decimals="0" data-type="string" data-originallength="6" class="data  not_null   text "&gt;Smith&lt;/td&gt;
       &lt;td data-decimals="0" data-type="string" data-originallength="1" class="data  not_null   text "&gt;&amp;quot;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>So what I need is to retrieve cell values.
  One more thing is that when viewing code via browser's source code option it looks same as above. But when using Firefox's firebug it additionally shows that values are inside of </p>
  
  <pre><code>&lt;span&gt;&lt;/span&gt;
  </code></pre>
  
  <p>tag</p>
  
  <p>I know that here xPath is the solution. For the past 2 hours I've tried so many but none of it worked.
  And of course I've seen similar questions' solutions on SO but somehow they are not suitable for me.</p>
  
  <p>What I'm trying to do:</p>
  
  <pre><code>WebElement table_element = driver.findElement(By.xpath("//table//tbody"));
      ArrayList&lt;WebElement&gt; rows = (ArrayList&lt;WebElement&gt;) table_element.findElements(By.tagName("tr"));
      for (WebElement row : rows) {
          ArrayList&lt;WebElement&gt; cells = (ArrayList&lt;WebElement&gt;) row.findElements(By.tagName("//td"));
          for (WebElement cell : cells) {
              System.out.println(cell.getText());
          }
      }
  </code></pre>