title: how to switch from parent window to child window using selenium webdriver
body: <p>I need to close a child window and switch back to the parent window to perform some operations. </p>
  
  <pre><code>public static void nextTab() throws InterruptedException { 
      Set winSet = UIPage.getBaseWindow().getWindowHandles(); 
      List winList = new ArrayList(winSet); 
      String newTab = winList.get(winList.size() - 1); UIPage.getBaseWindow().switchTo().window(newTab);
      Thread.sleep(Constant.LONG_TIMEOUT_500); 
  }
  
  public static void prevTab() { 
      Set winSet = UIPage.getBaseWindow().getWindowHandles(); 
      List winList = new ArrayList(winSet); 
      UIPage.getBaseWindow().close(); 
      String oldTab = winList.get(winList.size() - 2); //System.out.println(oldTab);
      UIPage.getBaseWindow().switchTo().window(oldTab);    
  }
  </code></pre>