title: Add the row count in an HTML table using protractor - non Angular
body: <p>I am trying to count the rows of the table and below is the HTML</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;tr id="resultsRepeaterGrid"&gt;
   &lt;tr id="tableheader"&gt;&lt;/tr&gt;
    &lt;tr id="Data list1_datarow class = row"&gt;
      &lt;div style&gt;row 1&lt;/div&gt;
      &lt;tr id = "expanded row"&gt;&lt;/tr&gt;
    &lt;/tr&gt;
    &lt;tr id="Data list2_datarow class= altrow"&gt;
      &lt;div style&gt;row 2&lt;/div&gt;
      &lt;tr id = "expanded row"&gt;&lt;/tr&gt;
    &lt;/tr&gt;
    &lt;tr id="Data list3_datarow class = row"&gt;
      &lt;div style&gt;row 1&lt;/div&gt;
      &lt;tr id = "expanded row"&gt;&lt;/tr&gt;
    &lt;/tr&gt;
  &lt;/tr&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I want to get the total count rows of the table, discarding table header and expanded row. I had tried the code below:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>searchRes = element(by.id('resultsRepeaterGrid')); //grid to be displayed
  browser.wait(EC.presenceOf(searchRes), 30000);
  var searchResCount = element.all(by.css('#resultsRepeaterGrid &gt; tr:not(.tableheader)'));
  expect(searchResCount.count()).toEqual(3);</code></pre>
  </div>
  </div>
  </p>
  
  <p>But I am getting Expected 0 to equal 3. Now I have thought of just getting the total of row and altrow classes and the code is below: </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> element.all(by.css('.row')).count().then(function (rowCount) {
              element.all(by.css('.altrow')).count().then(function (altRowCount) {
                  expect(rowCount + altRowCount).toEqual(1);
              })
          });</code></pre>
  </div>
  </div>
  </p>
  
  <p>I get an error of stale element. I am not sure now how to get the count of the row itself. Thanks</p>