【问题标题】:How can I get an item from UIAlertViewController for XCTest?如何从 UIAlertViewController 获取 XCTest 的项目?
【发布时间】:2019-11-25 22:26:48
【问题描述】:

我添加了这样的辅助功能键:

alertController.view.accessibilityIdentifier = "alertViewController"

当我尝试时:

app.otherElements["alertViewController"]

它不起作用。我怎样才能获得 alertController 中的动作?

【问题讨论】:

    标签: ios swift xctest


    【解决方案1】:

    警报控制器作为一个整体不是可访问性元素。您将需要搜索按钮(而不是其他元素)并使用本地化文本而不是标识符,因为您无权设置警报控制器的子视图的标识符。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-06-04
      • 1970-01-01
      • 2011-08-30
      • 1970-01-01
      • 1970-01-01
      • 2019-04-06
      • 1970-01-01
      相关资源
      最近更新 更多