i am having a Alert function as below :
UIATarget.onAlert = function onAlert(alert)
{
var title = alert.name();
UIALogger.logWarning("Alert with title '" + title + "' encountered!");
if (title == "Installation for this product is actually free with delivery - you will not be charged for installation.")
{
alert.buttons()["OK"].tap();
return true; // bypass default handler
}
return false; // use default handler
}
here i want execute a condition, if the alert message appears i want to execute
mainWindowTarget.scrollViews()[0].scrollToElementWithName("Add to cart");
var AddButton = mainWindowTarget.scrollViews()[0].buttons().firstWithName("Add to cart").tap();
So once the alert message comes the above two line should be executed
can somebody help on this