开发者

UIAutomation: how to access UIPopoverController?

开发者 https://www.devze.com 2023-03-13 05:12 出处:网络
I have an iPad app for which I\'m writing an UIAutomation script. There\'s an UIButton that shows an UIPopoverController when tapped. How can my script select (tap on) an item inside that popover?

I have an iPad app for which I'm writing an UIAutomation script. There's an UIButton that shows an UIPopoverController when tapped. How can my script select (tap on) an item inside that popover?

Edit: The UIAPopover is not a child of the UIButton it appears on but of mainWindow. So mainWindow.popover() gave it to me. The logElementTree() function is good for d开发者_如何学Pythonebugging and finding elements.


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();
0

精彩评论

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