我在尝试为我的 iPhone 应用程序编写一些自动化测试时遇到了障碍。判断from the documentation我觉得这应该选择我的 UIPickerView 的第一个组件的第一行:
var picker = UIATarget.localTarget().frontMostApp().mainWindow().pickers()[0];
var aWheel = picker.wheels()[0];
var someVals = aWheel.values();
aWheel.selectValue(someVals[0]);
但我在 Instruments 中收到以下错误:
Exception raised while running script: - selectValue requires a valid value
有什么办法吗
- 在我的 UIPickerView 单元格/组件上设置可预测的值?目前,他们都使用自定义 UIView,而不是标准标签。
或
- 以某种方式从我现有的单元格中获取一组值以进行迭代?
我在这里错过了什么?
最佳答案
我也有这个问题。
试试 var newValue = someVals[0].toString();
然后使用 newValue
在您的选择器中选择您的值:
aWheel.selectValue(newValue);
这对我有用
关于ios - UI自动化测试 : How do I select UIAPickerWheel values?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5523569/