单击 UI 未知元素:我得到“缺失值";

编程入门 行业动态 更新时间:2024-10-18 22:34:49
本文介绍了单击 UI 未知元素:我得到“缺失值";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我是苹果脚本的新手:

我使用 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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-17 13:51:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/915856.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:缺失   单击   元素   quot   UI

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!