【问题标题】:iOS UITest error when try to select picker element尝试选择选取器元素时出现 iOS UITest 错误
【发布时间】:2017-02-20 21:04:14
【问题描述】:

我正在尝试选择picker的一个元素,picker有Accessibility = picker_station,我为什么可以这样做?有什么问题吗?或者我需要使用其他代码。

let app = XCUIApplication()
app.pickers["picker_station"].pickerWheels.element.adjust(toPickerWheelValue: "Aberdeen")

xcode 错误是:

Testing Failure - Internal error: unable to find current value '1 of 152' in possible values

谢谢

【问题讨论】:

    标签: ios swift xcode8 xcode-ui-testing


    【解决方案1】:

    您使用正确,但 adjust(toPickerWheelValue:) 方法有问题,如下所述:https://forums.developer.apple.com/thread/16104

    【讨论】:

      【解决方案2】:

      我同意 Oletha 的观点,这似乎仍然是框架中未修复的错误。 我们至少可以暂时解决这个问题,方法是调用

      pickerWheel.swipeDown()
      

      打电话之前

      pickerWheel.adjust(toPickerWheelValue: "Value")
      

      否则我们会收到同样的崩溃。

      【讨论】:

        【解决方案3】:

        在屏幕上显示选择轮后,您可以通过以下方式更新值:

        app.pickerWheels.element.adjustToPickerWheelValue("Updated row value")
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2020-09-22
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2022-01-19
          • 2016-06-12
          • 2018-02-15
          • 1970-01-01
          相关资源
          最近更新 更多