go to rediff..
sign on click
don't enter email and click enter...alert will popup with msg enter email
public class Alerts {
public static void main(String[] args) throws InterruptedException {
WebDriver driver= new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(20,TimeUnit.SECONDS);
driver.get("http://www.rediff.com");
driver.findElement(By.linkText("signin ")).click();
driver.findElement(By.xpath("//*[@id='btn_login']")).sendKeys(Keys.ENTER);
Thread.sleep(1000L);
Alert Al= driver.switchTo().alert();
System.out.println(Al.getText());
Al.accept();//means OK
//Al.dismss(); //Cancel
//To switch back to regular page
driver.switchTo().defaultContent();
sign on click
don't enter email and click enter...alert will popup with msg enter email
public class Alerts {
public static void main(String[] args) throws InterruptedException {
WebDriver driver= new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(20,TimeUnit.SECONDS);
driver.get("http://www.rediff.com");
driver.findElement(By.linkText("signin ")).click();
driver.findElement(By.xpath("//*[@id='btn_login']")).sendKeys(Keys.ENTER);
Thread.sleep(1000L);
Alert Al= driver.switchTo().alert();
System.out.println(Al.getText());
Al.accept();//means OK
//Al.dismss(); //Cancel
//To switch back to regular page
driver.switchTo().defaultContent();