RE: How to Differentiate frames ,Pop Up Window , Alert ………….??????????

Hi Lakshay,
While Automating Facebook Sign Up Page ,there is 1 text Link ” Why do I need to provide my birthday?” on Date Of Birth Section. After clicking on that text link,1 Pop Up Message will come out.I am trying to handle that Pop Up Message considering as Pop Up Window using Iterator ,By passing Control to the Pop Up Window . But it is getting failed. I have tried  by considering it as alert …that also not working.
How to handle that text link ? is there any document to understand frames ,Pop Up Window and Alert ?

JOGESH Train Asked on August 27, 2014 in Selenium WebDriver.

Hi Jogesh,

PLease close this question if resolved.

Regards,
Lakshay Sharma

on September 12, 2014.
Add Comment
3 Answers

Hi Yogesh,
You can do like this

 
package mypackage;
import org.openqa.selenium.By;
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.WebElement;
 import org.openqa.selenium.firefox.FirefoxDriver;
public class popuphandling {
public static void main(String[] args ) throws InterruptedException
 {
 WebDriver driver= new FirefoxDriver();
 driver.get("http://www.facebook.com");
 WebElement sign = driver.findElement(By.xpath("/html/body/div/div[2]/div[1]/div/div[1]/div/div/div[2]/div/div/div/div/form/div[1]/div[5]/div[2]/a"));
 sign.click();
 Thread.sleep(2000);
driver.findElement(By.xpath("/html/body/div/div[2]/div[3]/div/div/div/div[2]/a")).click();
Thread.sleep(2000);
}
 }

 

Doctor Answered on September 2, 2014.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.