Wednesday, 2 September 2015

How to handle popup or alert messages using selenium web driver


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
             */
            public static void main(String[] 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();
 FOR VIDEOS PLEASE VISIT BELOW LINK



                       

No comments:

Post a Comment