单击 UI 未知元素:我得到“缺失值"; [英] Clicking an UI unknown element: I'm getting "missing value"

查看:25
本文介绍了单击 UI 未知元素:我得到“缺失值";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是苹果脚本的新手:

我使用 UI 浏览器来查找我想要单击的进程元素.我发现我想点击的元素是UI element 10"

I've used UI Browser to find an element of a process I'd like to click. I've found that the element I wanna click is "UI element 10"

这是我带来的:

tell application "System Events"
    tell application process "nameofmyapp" to tell window 1
        click UI element 10
    end tell
end tell

但它返回:缺失值".

我该如何解决这个问题?

How can I solve this?

推荐答案

系统事件有时会在单击按钮时出现问题,主要是在非本地可可应用程序窗口上.这是你的情况吗?

System Events has problems sometimes clicking buttons, mostly on non-native cocoa application windows. Is that your situation?

即使不是,我也写了一个命令行工具,可以让你执行鼠标点击.您可以在此处找到它.您可能想尝试一下.您必须按屏幕坐标单击事物,因此您必须以编程方式从系统事件中获取按钮的屏幕坐标,然后添加一些像素以将坐标移动到按钮的中间,然后使用我的工具单击它.我的网页上有示例 Applescript 代码,可以为您提供帮助.

Even if it's not, I wrote a command line tool that allows you to perform mouse clicks. You can find it here. You might want to try it. You have to click things by screen coordinates so you'll have to programmatically get the screen coordinates of the button from System Events, and then add some pixels to move the coordinates to the middle of the button, then click it with my tool. There's example applescript code on my web page to give you some help.

这篇关于单击 UI 未知元素:我得到“缺失值";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆