我正试图从应用程序上的UIPickerWheel中选择一个值。当我点击日期字段时,拾取轮弹出,值为月(一月、二月、…)、日期(1,2、…)和年(20132012…)
当我进行以下时,我得到了正确的值
**
selectedvalue = target.frontMostApp().mainWindow().pickers()[0].wheels()[0].value();
UIALogger.logDebug(selectedValue)
**
然而,当我尝试使用以下代码敲击方向盘时:
target.frontMostApp().mainWindow().pickers()[0].wheels()[0].tap();
我得到一个错误,该错误状态为无法点击target.frontMostApp().mainWindow().pickers()[0].wheels()[0],因为该元素在yyyyscript 的xxx行上不可见
我检查了UIAPickerWheel上的其他线程,这个特定的步骤似乎足够简单。然而,我很困惑,因为值是从轮子上检索出来的,但敲击并没有完成
如有任何帮助,我们将不胜感激!
谢谢和问候,Vinay
我有同样的问题,日期选择器不在树中
UIAWindow "(null)" {{0, 0}, {320, 568}}
elements: {
UIANavigationBar "Step 1: My Details" {{0, 20}, {320, 44}}
elements: {
UIAImage "(null)" {{0, 0}, {320, 64}}
elements: {
UIAImage "(null)" {{0, 64}, {320, 0.5}}
}
UIAButton "UINavigationBarBackIndicatorDefault.png" {{8, 32}, {12.5, 20.5}}
UIAStaticText "Step 1: My Details" {{88.5, 28}, {143, 27}}
}
UIAScrollView "(null)" {{0, 64}, {320, 310}}
elements: {
UIATextField "Ird" {{0, -4}, {320, 50}}
UIAImage "(null)" {{316.5, -4}, {3.5, 310}}
UIATextField "FirstName" {{0, 46}, {320, 50}}
UIATextField "MiddleName" {{0, 96}, {320, 50}}
UIATextField "LastName" {{0, 146}, {320, 50}}
UIATextField "DOB" {{0, 196}, {320, 50}}
UIAButton "Next" {{10, 256}, {300, 50}}
UIAImage "(null)" {{0, 302.5}, {320, 3.5}}
}
}
DOB文本字段的inputView设置为日期选择
通过使用Reveal,我可以看到日期选择器现在处于uitexteffectsview 之下
要用mechanic.js基本上回答我自己和你的问题,你可以用这个选择所有的uipicker
$('window > picker')[0]
我通过运行这个获得了完整的日志
UIALogger.logDebug("Pickers " + UIATarget.localTarget().logElementTree())
这是完整的日志
elements: {
UIAApplication "MyApp" {{0, 20}, {320, 548}}
elements: {
UIAWindow "(null)" {{0, 0}, {320, 568}}
elements: {
UIANavigationBar "Step 1: My Details" {{0, 20}, {320, 44}}
elements: {
UIAImage "(null)" {{0, 0}, {320, 64}}
elements: {
UIAImage "(null)" {{0, 64}, {320, 0.5}}
}
UIAButton "UINavigationBarBackIndicatorDefault.png" {{8, 32}, {12.5, 20.5}}
UIAStaticText "Step 1: My Details" {{88.5, 28}, {143, 27}}
}
UIAScrollView "(null)" {{0, 64}, {320, 310}}
elements: {
UIATextField "Ird" {{0, -4}, {320, 50}}
UIAImage "(null)" {{316.5, -4}, {3.5, 310}}
UIATextField "FirstName" {{0, 46}, {320, 50}}
UIATextField "MiddleName" {{0, 96}, {320, 50}}
UIATextField "LastName" {{0, 146}, {320, 50}}
UIATextField "DOB" {{0, 196}, {320, 50}}
UIAButton "Next" {{10, 256}, {300, 50}}
UIAImage "(null)" {{0, 302.5}, {320, 3.5}}
}
}
UIAWindow "(null)" {{0, 0}, {320, 568}}
elements: {
UIAPicker "(null)" {{0, 352}, {320, 216}}
elements: {
UIAPickerWheel "(null)" {{29, 314.5}, {135, 291}}
UIAPickerWheel "(null)" {{169, 314.5}, {46, 291}}
UIAPickerWheel "(null)" {{220, 314.5}, {72, 291}}
}
}
UIAWindow "(null)" {{0, 0}, {320, 568}}
elements: {
UIAStatusBar "(null)" {{0, 0}, {320, 20}}
elements: {
UIAElement "Swipe down with three fingers to reveal the notification center., Swipe up with three fingers to reveal the control center, Double-tap to scroll to top" {{6, 0}, {38, 20}}
UIAElement "3 of 3 Wi-Fi bars" {{49, 0}, {13, 20}}
UIAElement "9:49 AM" {{137, 0}, {47, 20}}
UIAElement "100% battery power" {{290, 0}, {25, 20}}
}
}
}
}