title: Accessing elements using $$ or elements in webdriverio
body: <p>I want to access web elements using the <code>$$</code> or <code>elements</code> command using webdriverio. I know they return array of web elements but I am facing tough time accessing them, probably because I am new to webdriverio.
  I tried the below code:</p>
  
  <pre><code>var webdriverio = require('webdriverio');
  var options = {
  desiredCapabilities: {
      browserName: 'firefox',        
  },
  };
  var client = webdriverio.remote(options);
  
  client
        .init()
        .url(some url)
        .isExisting(selector).then(function(isExisting)) {
        if(isExisting) {
         var bText = this.$$('textarea[name="message_text]')  // this code onwards it is not working
         bText.then(function (res) {
         console.log(res.length);
         console.log(res);
          res.value.forEach(function (elem) {
                 return this.click(elem.ELEMENT)
                 .setValue(elem.ELEMENT,'some text')
                 .keys('Enter')
             })
         })
  </code></pre>
  
  <p>In the above code, I can see the array <code>res</code> in console but the <code>forEach</code> loop doesn't seem to work. I want to perform <code>click, setValue and keys('Enter')</code> for each of the element present in <code>this.$$('textarea[name="message_text"]')</code> also  not able to understand why the returned elements are in a form of JSON objects?
  If anyone could guide me in right direction that would help!</p>