Clicking links with WebdriverIO
<p>I have a web page that I am trying to test via <a href="http://webdriver.io/" rel="nofollow">Webdriver I/O</a>. My question is, how do I click a couple of links via a test? Currently, I have the following:</p>

<pre><code>var webdriverio = require('webdriverio');
var client = webdriverio.remote(settings).init()
  .url('http://www.example.com')
  .elements('a')
  .then(function(links) {
    for (var i=0; i&lt;links.value.length; i++) {
      console.log('Clicking link...');
      var link = links.value[i].ELEMENT;
      link.click().then(function(result) {
        console.log('Link clicked!');
      });
    }
  })
;
</code></pre>

<p>When the above gets executed, I get an error that says "click is not a function" on link. When I print <code>link</code> to the console, it looks like JSON, which would make sense since the <a href="http://webdriver.io/api/protocol/elements.html" rel="nofollow">documentation</a> says that the elements function returns WebElement JSON objects. Still, I'm just trying to figure out how to click this link. </p>

<p>How does one do such?</p>

<p>Thanks!</p>