Thursday, January 16, 2014

Handling Alerts (WebDriver)

Snippet for Handling Alerts
 
Package Required for Alert----->   import org.openqa.selenium.Alert;

Alert class provides various methods such as:

 accept()
 dismiss()
 getText()

Alert alert = driver.switchTo().alert();
System.out.println(alert.getText());
alert.accept();
//alert.dismiss();

No comments:

Post a Comment