title: Protractor: counting all elements in a virtual list
body: <p>I have difficulities counting all elements. It only shows 11 elements at a time. While scrolling down, the first ones get replaced by the next elements.</p>
  
  <p>This is what I have:</p>
  
  <pre><code>element.all(by.css('.task-virtual-scroll')).click()
  browser.actions().keyDown(protractor.Key.CONTROL).sendKeys(protractor.Key.END).perform();
  
  function StringtoNumber(promiseOrValue) {
    if (!protractor.promise.isPromise(promiseOrValue)) { 
      // If it isn't a promise, then convert a value
      return parseInt(promiseOrValue, 10);
    }
  
    return promiseOrValue.then(function(stringNumber) { 
      // If it is a promise, then convert the result to a number
      return parseInt(stringNumber, 10);
    });
  }
  
  expect(element.all(by.css('mat-card&gt;mat-card&gt;mat-card-header')).count())
       .toEqual((StringtoNumber(element(by.css('#mat-badge-content-1')).getText()))); 
  // Expect that the notifications are equal to the notification in the badge
  </code></pre>