开发者

Has anyone got experience with UIAutomation for Xcode?

开发者 https://www.devze.com 2023-01-22 19:17 出处:网络
Greetings! I am running iOS 4.1 on my iPhone 3GS. I have a small test app that has a five segment segmented controller that is connected to a UIView (?). When one of the five segments is clicked, th

Greetings!

I am running iOS 4.1 on my iPhone 3GS.

I have a small test app that has a five segment segmented controller that is connected to a UIView (?). When one of the five segments is clicked, the picture changed in the IUView.

I am trying to automate this using UIAutomation using the following js script:

UIALogger.logStart("picChoice Test Started");

var mySegment = (UIAElementArray) segmentedControls() [2];

UIATarget.localTarget().frontMostApp().mainWindow().mySegment.tap();

My script is failing with a syntax error when run through Instrument's Automation tool.

Has anyone any point开发者_运维技巧ers (please excuse the poor pun) about how to script this properly?

TIA for any and all asistance!

Regards,

Steve O'Sullivan


I think what you want is (did not test it):

UIALogger.logStart("picChoice Test Started");
UIATarget.localTarget().frontMostApp().mainWindow().segmentedControls()[2].tap();

Note that segmentedControls()[2] returns a element not an array and that in your use of segmentedControls there is no context to find the segmented controls.

0

精彩评论

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