title: Selenium with JavaScript and Nodejs: How to count elements on page?
body: <p>I'm trying to use Selenium with Javascript (NodeJS) and I need to count some elements by CSS selector.</p>
  
  <p>I tried several approaches:</p>
  
  <pre><code>client.findElements(By.css(".some-class")).size();
  </code></pre>
  
  <p>It gives me:
  <code>Uncaught TypeError: client.findElements(...).size is not a function</code></p>
  
  <pre><code>client.findElements(By.css(".some-class")).Count();
  </code></pre>
  
  <p>It gives me:
  <code>Uncaught TypeError: client.findElements(...).size is not a function</code></p>
  
  <pre><code>client.findElements(By.css(".some-class")).length;
  </code></pre>
  
  <p>Here <code>length</code> is always undefined.</p>
  
  <p>What am I missing?</p>
  
  <p>Thanks in advance.</p>