Can anyone help me how to switch to new window after clicking on a hyperlink using selenium while doing automation . I have tried the following code but my test case is failing :
public void openView(){
final WebElement visa=driver.findElement(By.id("pageContainer"));
timeOut(10000);
final List<WebElement> images=visa.findElements(By.className("nametag"));
String handlewindow = driver.getWindowHandle();
for(String winHandle : driver.getWindowHandles()){
driver.switchTo().window(winHandle);
}
images.get(0).findElement(By.className("info")).findElement(By.tagName("a")).click();;