开发者

Can i use scroll and click action scripts inside alert function?

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 actuall开发者_如何学JAVAy 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


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..[]

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜