how to switch to another tab in selenium 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));