title: Windows vs tabs in Selenium
body: <p>As per <a href="https://stackoverflow.com/questions/15067107/difference-between-webdriver-dispose-close-and-quit">Difference between webdriver.Dispose(), .Close() and .Quit()</a>
  <code>driver.close</code> closes the current active <strong>window</strong> where <code>driver.quit</code> closes all of the <strong>windows</strong>. What I get is if I opened a new tab in my current window and then called <code>driver.close</code> the whole windows including my tabs would close. But when I run that code</p>
  <pre><code>driver.get(&quot;http://testingpool.com/selenium-ide-part-1/&quot;);
  driver.findElement(By.xpath(&quot;//*[@id='content']/div[2]/article/div/div[2]/div[1]/p[8]/span/a&quot;)).click(); //opens a new tab
  ArrayList&lt;String&gt; allWindowHandles = new ArrayList&lt;&gt; (driver.getWindowHandles());
  driver.close()
  </code></pre>
  <p>only the first tabs gets closed. Also I find that my allWindowHandles has length of 2 although I have only one window.
  I was trying to open a new window using Selenium as per <a href="https://www.tutorialspoint.com/how-to-open-a-new-window-on-a-browser-using-selenium-webdriver-for-python" rel="nofollow noreferrer">https://www.tutorialspoint.com/how-to-open-a-new-window-on-a-browser-using-selenium-webdriver-for-python</a> using</p>
  <pre><code>((JavascriptExecutor)driver).executeScript(&quot;window.open('')&quot;);
  </code></pre>
  <p>but that resulted in a new tab not a new window.</p>
  <p>I am confused if Selenium differentiates between a tab and a window at all or not.</p>