【问题标题】:iOS Instruments - UIADatePicker Error - Element is not visibleiOS Instruments - UIADatePicker 错误 - 元素不可见
【发布时间】:2013-12-04 20:14:29
【问题描述】:

我正在尝试从我的应用上的 UIPickerWheel 中选择一个值。当我单击日期字段时会弹出选择轮,其值为月份(1 月、2 月、...)、日期(1,2、...)和年份(2013 年、2012 年...)

当我执行以下操作时,我得到了正确的值

**

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 上的其他线程,这个特定的步骤似乎很简单。但是,我很困惑,因为正在从轮子中检索值但没有完成敲击

任何帮助将不胜感激!

感谢和问候, 维奈

【问题讨论】:

    标签: ios ipad xcode5 ios-ui-automation xcode-instruments


    【解决方案1】:

    我也有同样的问题,日期选择器不在树中

     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 设置为 datepick

    通过使用 Reveal,我可以看到日期选择器现在位于 uitexteffectsview 下

    要基本上用 mechanic.js 回答我自己的问题和你的问题,你可以用这个选择所有 uipickers

    $('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}}
                }
            }
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2015-11-12
      • 2018-10-23
      • 1970-01-01
      • 1970-01-01
      • 2016-10-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多