title: How can we switch to new opened tab with webdriver
body: <p>I have a scenario like when I click on a link it opened in new tab. Using Selenium WebDriver how can we handle it. </p>
  
  <p>As per my knowledge we can't switch to new tab but when I search in Web, got some below solutions. </p>
  
  <pre><code>ArrayList&lt;String&gt; tabs2 = new ArrayList&lt;String&gt; (driver.getWindowHandles());
  driver.switchTo().window(tabs2.get(1));
  driver.close();
  driver.switchTo().window(tabs2.get(0));
  </code></pre>
  
  <p>Unfortunately, every given solution contains driver.getWindowhandles(). But AFAIK even when a browser has multiple tabs it always returns only one handle.</p>
  
  <p>My scenario is, when I click on one button it opens in new tab.Could any one please provide some solution to </p>
  
  <ol>
  <li>Switch between Tabs or</li>
  <li>How to open that tab in new window.</li>
  </ol>