title: How to use basic commands in webdriver.io
body: <p>I'm using webdriver.io to do some browser automation.  Not really testing , just saving time by automating things. I can see examples of how to use some of the functions .. but I can't seem to access them. I'm quite new to node.js</p>
  
  <p>** Important ** I realise you can use browser.getAttribute - but looking at this example: <a href="http://webdriver.io/api/property/getAttribute.html" rel="nofollow noreferrer">http://webdriver.io/api/property/getAttribute.html</a></p>
  
  <p>I should be able to execute getAttribute on the element object..?</p>
  
  <pre><code>var allInputs = $$('.loginForm input')
  console.log(allInputs.map(function(el) { return el.getAttribute('name'); }))
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>var webdriverio = require('webdriverio');
  var options = {
      desiredCapabilities: {
          browserName: 'chrome'
      }
  };
  
  var browser = webdriverio.remote(options)
  
  async function browserTest(){
  
  await browser
      .init()
      .url('http://www.google.com')
      .getTitle().then(function(title) {
      console.log('Title was: ' + title);
      })
  .catch(function(err) {
      console.log(err);
  });
  
  var body = await browser.element("//body")
  
  console.log(body)
  
  //the following line fails
  console.log(await body.getAttribute("id"))
  </code></pre>
  
  <p>}</p>
  
  <p>browserTest()</p>