We have to navigate to the popup windows
driver.switchTo().window(“WindowName”);
To navigate from Popup window to main window
driver.switchTo().window(“MainWindowName”);
Below approach to handle Dynamically changing popup windows
Set<String> window1= driver.getWindowHandles();
Object s[]=window1.toArray();
driver.switchTo().window(s[1].toString());
Handle multiple popups windows
driver.getWindowHandles();