title: How to get handle of popup window (WebdriverIO)
body: <p>I am very very new to automated testing and I am currently completely stuck with the following issue:</p>
  
  <p>I have a webpage open(first window)
  In the same test I call a .newWindow(second window) and do some stuff in that window. The last action opens new popup window(popup window). 
  What I need, is to set the focus on a popup window. </p>
  
  <p>According to WebdriverIO API I can use .switchTab <a href="http://webdriver.io/api/window/switchTab.html" rel="nofollow">http://webdriver.io/api/window/switchTab.html</a>
  But to be able to switch to a popup window I have to indicate handle, but I don't understand how to get the handle of a popup window :(</p>
  
  <p>That s my piece of code:</p>
  
  <pre><code>//this is the part where I have already second window open
  it('should open email letter', function(done) {
  client
  .pause(2000)
  .clickAndWait('[title="Password restore"]', 4000)
  .clickAndWait('[title="Restore password"]', 7000) //this is the part where popup window opens
  .pause(2000)
  .windowHandles(function(err,res){
   console.log(res, handles)
   }) // I have got three handles but i dont know how to use them now
   .........
  </code></pre>
  
  <p>There is a lot of examples in java, but i didnt find anything that would fit mine language.
  Please, excuse me my dumbness, I am really a very beginner and I will appreciate if somebody could explain that to me.</p>
  
  <p>Thanks a lot in advance!  </p>