selenium how to switich to new tab code example
Example: switch tab in selenium
psdbComponent.clickDocumentLink();
ArrayList tabs2 = new ArrayList (driver.getWindowHandles());
driver.switchTo().window(tabs2.get(1));
driver.close();
driver.switchTo().window(tabs2.get(0));