title: Is there a better way to get this element/node with Nokogiri?
body: <p>I think the best way to explain this is via some code. Basically the only way to identify the TR I need inside the table (i've already reached the table itself and named it annual_income_statement) is by the text of the first TD in the TR, like this:</p>
  
  <p>this may be helpful to know, too:</p>
  
  <p><em>actual</em> html:</p>
  
  <pre><code>doc = Nokogiri::HTML(open('https://www.google.com/finance?q=NYSE%3AAA&amp;fstype=iii'))
  </code></pre>
  
  <p>html snippet:</p>
  
  <pre><code>&lt;div id="incannualdiv"&gt;
    &lt;table id="fs-table"&gt;
      &lt;tbody&gt;
        &lt;tr&gt;..&lt;/tr&gt;
        ...
        &lt;tr&gt;
          &lt;td&gt;Net Income&lt;/td&gt;
          &lt;td&gt;100&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;..&lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>original xpath</p>
  
  <pre><code>irb(main):161:0&gt; annual_income_statement = doc.xpath("//div[@id='incannualdiv']/table[@id='fs-table']/tbody")
  </code></pre>
  
  <p><code></code></p>
  
  <pre><code>irb(main):121:0&gt; a = nil
  =&gt; nil
  irb(main):122:0&gt; annual_income_statement.children.each { |e| if e.text.include? "Net Income" and e.text.exclude? "Ex"
  irb(main):123:2&gt;   a = e.text
  irb(main):124:2&gt; end }
  =&gt; 0
  irb(main):125:0&gt; a
  =&gt; "Net Income\n\n191.00\n611.00\n254.00\n-1,151.00\n"
  irb(main):127:0&gt; a.split "\n"
  =&gt; ["Net Income", "", "191.00", "611.00", "254.00", "-1,151.00"]
  </code></pre>
  
  <p>but is there a better way?</p>
  
  <p>more details:</p>
  
  <pre><code>doc = Nokogiri::HTML(open('https://www.google.com/finance?q=NYSE%3AAA&amp;fstype=iii'))
  div = doc.at "div[@id='incannualdiv']" #div containing the table i want
  table = div.at 'table' #table containing tbody i want
  tbody = table.at 'tbody' #tbody containing tr's I want
  trs = tbody.at 'tr' #SHOULD be all tr's of that table/tbody - but it's only the first TR?
  </code></pre>
  
  <p>I expect that last bit to give me ALL the TR's (which would include the TD i'm looking for)
  but in fact it <em>only gives me the first TR</em></p>