Hi I am using the following code for handling the alert box after clicking an action but it isn't working Can somebody please help.
This is where I call the handler. clickOnAlert() after clickOnAddQuote() is called alert box appears.
System.out.println("before add to quote");
this.clickOnAddQuote();
System.out.println("before alert");
this.clickOnAlert();
System.out.println("after alert");
function clickOnAlert()
public void clickOnAlert() {
System.out.println("In click");
Alert alert = webdriverSession().switchTo().alert();
System.out.println("after constructor");
alert.accept();
}
Please help. Thanks
Alert
class will only work if standard javascript alerts. (Those that you get when you execute something likealert(test)
. If it is not a standard JS alert, this will not work. – Arran Nov 26 '12 at 12:22