title: accessing <td> value with selenium
body: <p>Using selenium i'm trying to read out a dynamically generated table, i got down to the right elements (using the <code>findElement</code> method) but using <code>getText()</code> on them returns nothing.</p>
  
  <p>Probably because <code>getText()</code> looks for quotation marks when returning "text" and can't find any between the <code>&lt;td&gt;</code> tags. Some suggestions were to use xpaths but since the tables are generated dynamically the location of the value i need also changes.</p>
  
  <p>here's the table i'm trying to get 3 data points from:</p>
  
  <pre><code>&lt;table cellpadding="0" cellspacing="0" class="fleetinfo"&gt;
          &lt;tbody&gt;&lt;tr&gt;
              &lt;th colspan="2"&gt;Schepen:&lt;/th&gt;
          &lt;/tr&gt;
                  &lt;tr&gt;
              &lt;td&gt;Groot vrachtschip:&lt;/td&gt;
              &lt;td class="value"&gt;
                              40                        &lt;/td&gt;
          &lt;/tr&gt;
                  &lt;tr&gt;
              &lt;td colspan="2"&gt;&amp;nbsp;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;th colspan="2"&gt;Lading:&lt;/th&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Metaal:&lt;/td&gt;
              &lt;td class="value"&gt;
                  536.062            &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Kristal:&lt;/td&gt;
              &lt;td class="value"&gt;
                  289.008            &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Deuterium:&lt;/td&gt;
              &lt;td class="value"&gt;
                  92.750            &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;&lt;/table&gt;
  </code></pre>
  
  <p>the ones i'm interested in are the ones inside the <code>&lt;td class="value"&gt;</code> tags but as i said before, using <code>getText()</code> on them returns null.</p>
  
  <p>Any idea on how i can acces those values?</p>
  
  <p>edit: here's how i'm doing it now</p>
  
  <pre><code>private int getMetalFromFleet(WebElement fleet)
      {
          int ret=0;
  
          WebElement streak = fleet.findElement(By.className("starStreak"));
          List&lt;WebElement&gt;fleetDetails = streak.findElements(By.tagName("tr"));
  
          for(WebElement detail : fleetDetails)
          {
              List&lt;WebElement&gt; tabel = detail.findElements(By.tagName("td")); 
  
              if(tabel.size() != 2)
                  continue;
  
              if(tabel.get(0).getText().equalsIgnoreCase("metaal:"))
              {
                  ret = Integer.parseInt(tabel.get(1).getText());
                  break;
              }
          }
  
          return ret;
      }
  </code></pre>
  
  <p>edit: here's the relevant bit of html</p>
  
  <pre><code>&lt;div id="fleet9965869" class="fleetDetails detailsOpened" data-mission-type="4" data-return-flight="false" data-arrival-time="1378241688"&gt;
          &lt;span class="timer tooltip" title="03.09.2013 22:54:48" id="timer_9965869"&gt;58m 48s&lt;/span&gt;
          &lt;span class="absTime"&gt;22:54:48 Klok&lt;/span&gt;
          &lt;span class="mission neutral textBeefy"&gt;Plaatsen&lt;/span&gt;
          &lt;span class="allianceName"&gt;&lt;/span&gt;
          &lt;span class="originData"&gt;
              &lt;span class="originCoords tooltip" title="killernerd"&gt;&lt;a href="http://uni107.ogame.nl/game/index.php?page=galaxy&amp;amp;galaxy=5&amp;amp;system=213"&gt;[5:213:8]&lt;/a&gt;&lt;/span&gt;
              &lt;span class="originPlanet"&gt;
                  &lt;figure class="planetIcon planet tooltip js_hideTipOnMobile" title="planeet"&gt;&lt;/figure&gt;k7                            &lt;/span&gt;
          &lt;/span&gt;
          &lt;span class="marker01"&gt;&lt;/span&gt;        
          &lt;span class="marker02"&gt;&lt;/span&gt;
          &lt;span class="fleetDetailButton"&gt;
              &lt;a href="#bl9965869" rel="bl9965869" title="Vlootdetails" class="tooltipRel tooltipClose fleet_icon_forward"&gt;
              &lt;/a&gt;
          &lt;/span&gt;
                  &lt;span class="reversal reversal_time" ref="9965869"&gt;
                  &lt;a class="icon_link tooltipHTML" href="http://uni107.ogame.nl/game/index.php?page=movement&amp;amp;return=9965869" title="Roep terug:| 04.09.2013&amp;lt;br&amp;gt;01:54:05"&gt;
                      &lt;img src="http://gf2.geo.gfsrv.net/cdna2/89624964d4b06356842188dba05b1b.gif" height="16" width="16"&gt;
                  &lt;/a&gt;
              &lt;/span&gt;
              &lt;span class="starStreak"&gt;
              &lt;div style="position: relative;"&gt;
                  &lt;div class="origin fixed"&gt;
                      &lt;img class="tooltipHTML" height="30" width="30" src="http://gf1.geo.gfsrv.net/cdnf0/af41c52dc08208b4463f4a4608e88c.png" title="" alt=""&gt;
                  &lt;/div&gt;
  
                  &lt;div class="route fixed"&gt;
  
                      &lt;a href="#bl9965869" rel="bl9965869" title="Vlootdetails" class="tooltipRel tooltipClose basic2 fleet_icon_forward" id="route_9965869" style="margin-left: 220px;"&gt;&lt;/a&gt;
  
                      &lt;div style="display:none;" id="bl9965869"&gt;
                          &lt;div class="htmlTooltip"&gt;
      &lt;h1&gt;Vlootdetails:&lt;/h1&gt;
      &lt;div class="splitLine"&gt;&lt;/div&gt;
      &lt;table cellpadding="0" cellspacing="0" class="fleetinfo"&gt;
          &lt;tbody&gt;&lt;tr&gt;
              &lt;th colspan="2"&gt;Schepen:&lt;/th&gt;
          &lt;/tr&gt;
                  &lt;tr&gt;
              &lt;td&gt;Groot vrachtschip:&lt;/td&gt;
              &lt;td class="value"&gt;
                              960                        &lt;/td&gt;
          &lt;/tr&gt;
                  &lt;tr&gt;
              &lt;td colspan="2"&gt;&amp;nbsp;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;th colspan="2"&gt;Lading:&lt;/th&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Metaal:&lt;/td&gt;
              &lt;td class="value"&gt;
                  8.173.484            &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Kristal:&lt;/td&gt;
              &lt;td class="value"&gt;
                  6.325.966            &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Deuterium:&lt;/td&gt;
              &lt;td class="value"&gt;
                  7.474.821            &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;&lt;/table&gt;
  &lt;/div&gt;                    &lt;/div&gt;
  
                  &lt;/div&gt;
  
                  &lt;div class="destination fixed"&gt;
                      &lt;img class="tooltipHTML" height="30" width="30" src="http://gf2.geo.gfsrv.net/cdnaa/af0b356fdbecc1cfc47130e990fa66.png" title="Aankomsttijd:| 03.09.2013&amp;lt;br&amp;gt;22:54:48" alt=""&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/span&gt;&lt;!-- Starstreak --&gt;
          &lt;span class="destinationData"&gt;
                          &lt;span class="destinationPlanet"&gt;
                  &lt;span&gt;
                      &lt;figure class="planetIcon planet tooltip js_hideTipOnMobile" title="planeet"&gt;&lt;/figure&gt;Hoelbrak                                    &lt;/span&gt;
              &lt;/span&gt;
  
                              &lt;span class="destinationCoords tooltip" title="killernerd"&gt;&lt;a href="http://uni107.ogame.nl/game/index.php?page=galaxy&amp;amp;galaxy=1&amp;amp;system=2"&gt;[1:2:6]&lt;/a&gt;&lt;/span&gt;
  
          &lt;/span&gt;
          &lt;span class="nextTimer tooltip" title="04.09.2013 03:52:31" id="timerNext_9965869"&gt;5u 56m 31s&lt;/span&gt;
          &lt;span class="nextabsTime"&gt;03:52:31 Klok&lt;/span&gt;
          &lt;span class="nextMission friendly textBeefy"&gt;Keer terug&lt;/span&gt;
          &lt;span class="openDetails"&gt;
              &lt;a href="javascript:void(0);" class="openCloseDetails" data-mission-id="9965869" data-end-time="1378241688"&gt;
                  &lt;img src="http://gf3.geo.gfsrv.net/cdnb6/577565fadab7780b0997a76d0dca9b.gif" height="16" width="16"&gt;
              &lt;/a&gt;
          &lt;/span&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>the values i need are the numeric values under "Metaal", "kristal" and "deuterium".</p>