UIAutomation:如何访问UIPopoverController?

时间:2011-06-16 11:36:41

标签: ios uipopovercontroller ios-ui-automation

我有一个iPad应用程序,我正在编写UIAutomation脚本。有一个UIButton在点击时显示UIPopoverController。我的脚本如何选择(点击)该弹出框内的项目?

编辑: UIAPopover不是它出现在主要窗口上的UIButton的子节点。所以mainWindow.popover()给了我。 logElementTree()函数适用于调试和查找元素。

1 个答案:

答案 0 :(得分:3)

UIALogger.logMessage("tap state");
var state = buttons[0];
state.tap();

UIALogger.logMessage("wait for State Popover Screen to display");
target.delay(1);

UIALogger.logMessage("scroll to District of Columbia");
window.popover().tableViews()[0].scrollToElementWithName("District of Columbia");

UIALogger.logMessage("select District of Columbia");
var dc = window.popover().tableViews()[0].cells()["District of Columbia"];
dc.tap();
相关问题