Need to display the alert box and click OK while running the script. I have used javascript alerts.
Eg:
function validateMob(val) {
var temp = val.trim();
if (temp == null || temp == "") {
alert("Enter Mobile Number");
return false;
} else if (temp.length != 10) {
alert("Enter Valid Mobile Number");
return false;
}
else {
return true;
}
}
Also have used to verify the text in the alert box
Alert alert = driver.switchTo().alert();
String text=alert.getText();
alert.accept();
Need to display the alert box and click OK. Is it not possible to view the alert box using selenium web driver ?