ios - UI自动化测试 : How do I select UIAPickerWheel values?

标签 ios testing ios4 uipickerview ios-ui-automation

我在尝试为我的 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/

相关文章:

ios - 应用程序在后台运行时如何处理 AVPlayer 错误?

image - 合并两个 UIImages

ios - 使用 APNS 将应用程序从临时阶段转移到应用程序商店分发时,供应配置文件发生变化

ios - 错误 ITMS-90206 无效的包包含不允许的文件 'Frameworks'

objective-c - 如何通过单击按钮更改 UIPickerView 中行的大小?

unit-testing - JEST 不会触发模拟函数 Vue js

angularjs - 使用 Protractor 从桌面拖放

ios - 撤销 APNs 证书后仍然收到推送通知

python - Django 测试用例 : recreate database in self. 子测试(...)

ios - 如何将 MaxDate 和 MinDate 设置为从 ios 上的 web 服务返回的 DatePicker