In order to press enter key on pop up, first switch to popup using getWindowHandles()
and later pass in the enter key using Actions()
interface. Here's how to do it -
String subWindowHandler = null;
Actions action = new Actions(webDriverInstance);
Set<String> windowHandler = driver.getWindowHandles(); // get all window handles
Iterator<String> iterator = windowHandler.iterator();
while (iterator.hasNext()){
subWindowHandler = iterator.next();
}
driver.switchTo().window(subWindowHandler); //switch to pop up
//Perform your actions on the pop up
action.sendKeys(Keys.RETURN).perform(); //press enter key
Hope this helps.