I'm working on a test case in Java and am using selenium to record a set of events and "replay" them to an app. The code is:
// *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 valid but inaccessible due to a css banner that is shown when the new window is opened. Running selenium IDE gives the following events:
Command :: Target
click css=a.close
How can I replay the command in Java so that the web driver closes the banner?