Quite often you may want to open a new tab in the same browser window that is running your Selenium WebDriver tests. Instead of opening a new browser, you can simply use the code below to open a new tab in the same browser:
Then when you open a new tab, you have to switch to it to be able to work with the newly opened tab:
ArrayList<String> tabs = new ArrayList<String> (driver.getWindowHandles());
The above code works for Firefox Browser.