How to handle popup or alert messages
using selenium web driver
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import
org.openqa.selenium.firefox.FirefoxDriver;
public class webbb {
/**
* @param args
*/
WebDriver wd=new FirefoxDriver();
wd.get("http://mypage.rediff.com/login");
wd.findElement(By.xpath(".//*[@id='toprightinfo']/a[1]")).click();
wd.findElement(By.xpath(".//*[@id='c_uname']")).click();
wd.findElement(By.xpath(".//*[@id='btn_login']")).click();
Alert abox
=wd.switchTo().alert();
abox .accept();
//abox.dismiss();
No comments:
Post a Comment