Below method will handle the alert dialog displayed and also it will return the alert message displayed.
public String getAlert() { Alert alert = driver.switchTo().alert(); String alertMsg = alert.getText(); alert.accept(); return alertMsg; }
please say the coding for isAlertPresent() in selenium web driver ..how to check whether the alert is present or not...kindly say soon ...tom i need to submit my project...
ReplyDeleteFor isAlertPresent() how to return boolean value in java ..say tat coding also
ReplyDeleteCheck the below link:
ReplyDeletehttp://seleniumwebdriverfaq.blogspot.in/2012/05/how-to-check-presence-of-alert.html