Unable to close the popup which appears after webpage opens | Selenium Forum
M
Posted on 18/09/2016
URL: "http://us.makemytrip.com/"

a popup window appears immediatly webpage is opened.

Have tried to handle it as :
1. tried WebDriverWait with below options of ExpectedConditions:
wait.until(ExpectedConditions.alertIsPresent());
//.elementToBeClickable(rad)); //.visibilityOf(rad));
//visibilityOfElementLocated(By.xpath(rad)));
2. Tried to catch it as an alert
Alert alert = driver.switchTo().alert();
alert.getText();
alert.accept();*/
// action.moveToElement(rad).click().perform();

4. Tried to close that as window
WebDriverWait wait=new WebDriverWait(driver,30);
Set<String> windws=driver.getWindowHandles();
Iterator<String> itererator = windws.iterator();
String mnwndw=itererator.next();
String subwndw=itererator.next();
driver.switchTo().window(subwndw);
System.out.println(driver.getTitle());
Thread.sleep(3000);
driver.close();

M
Replied on 18/09/2016

check if its in iframe and after that just click on cross button on the top right hand side.