UIAPickerWheel 不工作
我一直在努力使用 UIAutomation 中的 UIAPickerWheel 来测试 UIDatePicker。它是一个日期选择器,由月、日和年轮组成。这是我的代码。
var monthWheel = w.pickers()[0].wheels()[0];
UIALogger.logMessage(monthWheel.logElementTree()); // This line output seems right
// 5) UIAPickerWheel [name:(null) value:September rect:{{x:21, y:265}, {width:147, height:216}}]
UIALogger.logMessage(monthWheel.isValid()); // This line output 1
var length = monthWheel.values().length; // error: "Result of expression 'monthWheel.values()' [null] is not an object.";
I have been struggling with UIAPickerWheel in UIAutomation to test UIDatePicker. It's a date picker consisting of Month, Day and Year wheels. Here is my code.
var monthWheel = w.pickers()[0].wheels()[0];
UIALogger.logMessage(monthWheel.logElementTree()); // This line output seems right
// 5) UIAPickerWheel [name:(null) value:September rect:{{x:21, y:265}, {width:147, height:216}}]
UIALogger.logMessage(monthWheel.isValid()); // This line output 1
var length = monthWheel.values().length; // error: "Result of expression 'monthWheel.values()' [null] is not an object.";
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您有特定的轮子,则可以使用 .value() 获取当前值,或 selectValue(str) 来选择新值。这是我用来增加所选日期的片段:
在本例中,wheels()[1] 是该月中的某一天(选择器的第二个轮子),这就是我想要增加的值。
If you have a particular wheel, you can use .value() to get the current value, or selectValue(str) to select a new value. Here's a snippet I use to increment the date selected:
In this case wheels()[1] is the day of the month (the second wheel of the picker), which is what i wanted to increment.