Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

Alert function will handle the alert which are popped up and it is automatically called. However to use scroll view and tap over it you first have to dismiss the alert pop and then come back to the screen having scroll view. But its good to experiment the same..[]

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.