title: Counting table rows in WebdriverIO
body: <p>I am testing a webshop with a dynamical webtable that can contain anywhere from 0 to 100 rows (orders). I am forced to use NodeJS and WebdriverIO for this, both very new for me.  </p>
  
  <p>I want to delete every order that has 'Open'status. I am used to working with Java, where I would just add all applicable webelements to an array, and then put the delete command in a loop that would run for as many times as the array is long.</p>
  
  <p>I managed to create the needed loop like this (open orders are always on top, loop is allowd to break as soon as it encounters a non open order:</p>
  
  <pre><code>for (var i = 1; i &lt; 5; i++) { 
        var orderStatus = browser.getText("//*[@class='jum-order-list-table-b2c']//tr[1]//*[@class='jum-status']/div[2]/span")
        console.log(orderStatus)
        if (orderStatus != 'Open') { break; } 
          browser.pause(1000)
          browser.click("//*[@class='jum-order-list-table-b2c']//tr[1]//*[@class='jum-list-actions']/div/a")
          browser.pause(1000)
          browser.click("//*[@value='Bestelling annuleren']")
          browser.pause(1000)
          browser.click("//*[@class='ui-dialog-buttonset']//button[2]")
          browser.pause(1000)     
  </code></pre>
  
  <p>but I can't figure out how to make an array of webelements.</p>
  
  <p>I managed to come up with this: </p>
  
  <pre><code>var orderTable = browser.getText("//*[@class='jum-order-list-table-b2c']//*[@class='jum-order-number']/div[2]")
  </code></pre>
  
  <p>But this only creates an array when there are more then 1 elements. I also want it to be an array when there are no, or just 1 webelements</p>
  
  <p>Can anyone tell be how I can achieve this?</p>
  
  <p>The part of the site I am working with looks like this:</p>
  
  <pre><code>&lt;tbody&gt;
    &lt;tr class="jum-open-order-row"&gt;
      &lt;td class="jum-order-type jum-ga-b2b-bestellingen-orderdata"&gt;
      &lt;td class="jum-cell-bold"&gt;
      &lt;td class="jum-order-number"&gt;
      &lt;td class="jum-status"&gt;
      &lt;td class="jum-price"&gt;
      &lt;td class="jum-list-actions"&gt;
    &lt;/tr&gt;
    &lt;tr class="jum-open-order-row"&gt;
    &lt;tr class="jum-open-order-row"&gt;
    &lt;tr class="jum-open-order-row"&gt;
  &lt;/tbody&gt;
  </code></pre>