title: Get data using HAP (HTML Agility Pack) From Page
body: <p>A continuation of <a href="https://stackoverflow.com/questions/13936841/match-table-w-regex">this post</a>, I am trying to parse out some data from an HTML page. Here is the HTML (there is more info on the page, but this is the important section):</p>
  
  <pre><code>&lt;table class="integrationteamstats"&gt;
  &lt;tbody&gt;
  &lt;tr&gt;
      &lt;td class="right"&gt;
          &lt;span class="mediumtextBlack"&gt;Queue:&lt;/span&gt;
      &lt;/td&gt;
      &lt;td class="left"&gt;
          &lt;span class="mediumtextBlack"&gt;0&lt;/span&gt;
      &lt;/td&gt;
      &lt;td class="right"&gt;
          &lt;span class="mediumtextBlack"&gt;Aban:&lt;/span&gt;
      &lt;/td&gt;
      &lt;td class="left"&gt;
          &lt;span class="mediumtextBlack"&gt;0%&lt;/span&gt;
      &lt;/td&gt;
      &lt;td class="right"&gt;
          &lt;span class="mediumtextBlack"&gt;Staffed:&lt;/span&gt;
      &lt;/td&gt;
      &lt;td class="left"&gt;
          &lt;span class="mediumtextBlack"&gt;0&lt;/span&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td class="right"&gt;
          &lt;span class="mediumtextBlack"&gt;Wait:&lt;/span&gt;
      &lt;/td&gt;
      &lt;td class="left"&gt;
          &lt;span class="mediumtextBlack"&gt;0:00&lt;/span&gt;
      &lt;/td&gt;
      &lt;td class="right"&gt;
          &lt;span class="mediumtextBlack"&gt;Total:&lt;/span&gt;
      &lt;/td&gt;
      &lt;td class="left"&gt;
          &lt;span class="mediumtextBlack"&gt;0&lt;/span&gt;
      &lt;/td&gt;
      &lt;td class="right"&gt;
          &lt;span class="mediumtextBlack"&gt;On ACD:&lt;/span&gt;
      &lt;/td&gt;
      &lt;td class="left"&gt;
          &lt;span class="mediumtextBlack"&gt;0&lt;/span&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I need to get 2 pieces of information: the data inside of the td below Queue and the data inside the td below Wait (so the Queue count and wait time). Obviously the numbers are going to update frequently.</p>
  
  <p>I have gotten to the point where the HTML is pilled into an HtmlDocument variable. And I've found something along the lines of using an HtmlNodeCollection to gather nodes that meet a certain criteria. This is basically where I am stuck:</p>
  
  <pre><code>HtmlNodeCollection tds = 
      new HtmlNodeCollection(this.html.DocumentNode.ParentNode);
  tds = this.html.DocumentNode.SelectNodes("//td");
  
  foreach (HtmlNode td in tds)
  {
      /* I want to write:
       * If the last node's value was 'Queue', give me the value of this node.
       * and
       * If the last node's value was 'Wait Time', give me the value of this node.
       */
  }
  </code></pre>
  
  <p>And I can go through this with a <code>foreach</code>, but I am not certain how to access the value or how to get the next value.</p>