【问题标题】:How to tap a button in UI Automation which has only coordinates?如何点击 UI 自动化中只有坐标的按钮?
【发布时间】:2015-08-27 03:09:38
【问题描述】:

我只有按钮的坐标:

UIAButton:rect:{{253,27},{60,30}}

我存储在一个数组中。我想在不提供坐标的情况下特别点击此按钮,以便其余按钮通用。

谢谢。

【问题讨论】:

  • 您使用坐标而不是对对象本身的引用是否有原因?
  • 如果按钮设置为可访问,则在相应的 UIAElement 上调用 .tap() 比尝试制作一个在坐标或坐标上不起作用的通用点击更有意义参考。

标签: javascript instruments ios-ui-automation xcode-instruments


【解决方案1】:

我会做类似this question 中所示的事情。

UIATarget.localTarget().frontMostApp().tapWithOptions({tapCount: 1, tapOffset: {x: 0, y: 0});

您可以将 tapOffset 中的零替换为所需的 x 和 y 值。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-02-17
    • 2019-05-29
    • 1970-01-01
    • 1970-01-01
    • 2018-01-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多