【问题标题】:Can the click method in XCUIElement be used outside of the testing framework?XCUIElement 中的 click 方法可以在测试框架之外使用吗?
【发布时间】:2022-01-18 20:58:29
【问题描述】:

我想在没有用户输入的情况下单击一个元素。我看到 XCUIElement 是 XCTest 框架的一部分,可以确保一切正常工作,而且我知道其他各种支持通过模拟点击进行 E2E 测试的测试框架。但是有可能在测试之外在生产中触发这个吗?例如。应用程序遥控器如何在电视上工作 - 按下应用程序上的按钮将向右、向左移动或单击电视上的对象(仅从该问题中删除电视并使其针对正在运行的操作系统)

【问题讨论】:

    标签: ios swift objective-c


    【解决方案1】:

    似乎无法访问其他应用程序 - https://developer.apple.com/forums/thread/698795?login=true

    但他们确实推荐了一种以编程方式单击在此处的另一个堆栈溢出帖子中找到的按钮的方法 - how to programmatically fake a touch event to a UIButton?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-22
      • 1970-01-01
      • 2016-04-25
      • 2017-11-08
      相关资源
      最近更新 更多