# accept()
This method can be used to click 'OK' button in a popup
WebDriver firefoxDriver=new FirefoxDriver();
Alert alert = firefoxDriver.switchTo().alert();//Creating object for Alert class
alert.accept();//Clicking OK button
# dismiss()
Canceling popup using dismiss method
WebDriver firefoxDriver=new FirefoxDriver();
Alert alert = firefoxDriver.switchTo().alert();
alert.dismiss();//Canceling the popup
# getText()
Getting popup text
String strAlertText;
WebDriver firefoxDriver=new FirefoxDriver();
Alert alert = firefoxDriver.switchTo().alert();
strAlertText=alert.getText();//This line retrieves text from popup.
System.out.println(strAlertText);
Rerarding for query
ReplyDeleteFeatures of TestNG and list some of the functionality in TestNG which makes it more effective?
http://www.bestqtptraining.com/