Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to handle alert popup in Selenium

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 354
    Comment on it

    Alerts are handled in selenium through the method of alert class.

    WebDriver driver = new FirefoxDriver();
    driver.navigate().to("http://www.rediff.com/");
    driver.findElement(By.xpath("//*[@id='signin_info']/a[1]")).click();
    driver.findElement(By.xpath("//*[@id='btn_login']")).click();
    
    Alert alert = driver.switchTo().alert();
    System.out.println(alert.getText());
    Thread.sleep(2000);
    alert.accept();
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: