selenium how to switch between tabs 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));