Currently, I am working on a test case in Java where I am using Selenium to record a series of events and then play them back on an application. Here is the code snippet I have:
// *The app opens a new window*
// Get handle of the main window
String mainWindowHnd = webDriver.getWindowHandle();
// Get all open window handlers
Set openWindows = webDriver.getWindowHandles();
Iterator ite=openWindows.iterator();
// Select the new windows (there are two that are open)
while(ite.hasNext())
{
String popupHandle=ite.next().toString();
if(!popupHandle.contains(mainWindowHnd))
{
webDriver.switchTo().window(popupHandle);
}
}
WebElement liveId = webDriver.findElement(By.id("c_clogoc"));
The ID of the last statement is correct but inaccessible due to a CSS banner that appears when the new window opens. When running Selenium IDE, these are the recorded events:
Command
:: Target
click css=a.close
I am wondering how I can replay this command in Java so that the WebDriver closes the banner?