I am doing my work on java Selenium WebDriver. I want to handle frame and multiple popup windows on the same web page?
I have done with handle the frame and going back to default Content. Now I am facing problem in handle multiple popup windows on the same web page?
I have tried with following methods:
//First method
WebDriverWait wait = new WebDriverWait(driver, 20);
wait.until(ExpectedConditions.elementToBeClickable(By.id("masterPOP")));
driver.findElement(By.id("close-popup")).click();
//Another method
Alert alert = driver.switchTo().alert();
alert.dismiss();
//I am sharing my code below:
package BRA_product;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class frameeeeeee {
public static void main(String[] args) throws InterruptedException {
String exePathGecko=("C:\\Users\\Prerna\\Downloads\\geckodriver.exe");
System.setProperty("webdriver.gecko.driver",exePathGecko);
WebDriver driver=new FirefoxDriver();
//Zivame home page
driver.get("http://www.zivame.com/#?");
//switch to frame
driver.switchTo().frame("webpush-bubble");
driver.findElement(By.xpath(".//*[@id='deny']")).click();
//back to home page
driver.switchTo().defaultContent();
//login to zivame
driver.findElement(By.xpath("//a[@href='#myaccount']")).click();
driver.findElement(By.xpath("//*[@id='auth-email']")).sendKeys("test890@gmail.com");
driver.findElement(By.xpath(".//*[@id='auth-password']")).sendKeys("test123");
driver.findElement(By.xpath(".//*[@id='authForm']/div[3]/button")).click();
//Thread.sleep(3000);
driver.quit();
}
}
EDIT: Error which i got is:
Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element: //*[@id='auth-email']
I am getting this error because not able to close two popup on the same page. popup id is :<id=materPOP>
and
<p id ="close-pop">
.
Another popup id details are: <div class="wrapper">
and <div id ="webklipper-publisher-widget-container-notification-close-div" class="close">
. Another popup id details are: