我可以在警报功能中使用滚动和单击操作脚本吗?
我有一个警报功能如下:
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
}
这里我想执行一个条件,如果出现警报消息我想执行
mainWindowTarget.scrollViews()[0].scrollToElementWithName("Add to cart");
var AddButton = mainWindowTarget.scrollViews()[0].buttons().firstWithName("Add to cart").tap();
所以一旦警报消息出现在上面应该执行两行
有人可以帮忙吗
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(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..[]