桌面应用界面自动化操作
using-computer-use
通过 cua-driver CLI 驱动桌面上任何应用的真实 UI:在截图中查看应用界面,当应用具备无障碍树时通过该树读取信息,并执行点击和输入。适用于桌面应用和原生应用,以及任何没有更好方案、但足够真实能够有效验证的场景。
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 3
- Forks
- 0
01 前言 Front Matter
- name
- using-computer-use
- description
- Drive any app's real UI on the desktop through the cua-driver CLI: see it in screenshots, read it through its accessibility tree when it has one, click and type. Use for desktop and native apps, and for anything with no better option that is also realistic enough to validate effectively.
03 SKILL.md 正文
Once you have deemed it appropriate to use computer input, follow the guidelines below. Computer use is slow and may take focus from the user, so prefer using other methods when possible.
Calling it
cua-driver call <tool>with the JSON arguments on stdin; the result is JSON.cua-driver list-toolslists the tools andcua-driver describe <tool>gives a tool's arguments.- Start with
start_sessionand pass the samesessionlabel on every call, thenend_sessionat the end. Element tokens from one session are refused in another (stale_element_token). - The daemon is already running; never run
serve,stop, orupdate.
Seeing the app
Two ways, both first class. Every app works with the first.
- Screenshots:
get_window_statewithscreenshot_out_filewrites a PNG; open it with your file viewing tool to see it. Act on window-local pixels from that screenshot (click,double_click,scroll,drag), with itscapture_idso stale coordinates are refused. For a small target,zoomthen click withfrom_zoom: true. Take a new screenshot before each pixel click; a coordinate from an older one can hit the wrong control. - Accessibility tree, when the app has one: element tokens, values, and
verify_state. It is faster, works in the background, and gives exact text. Tokens are valid only for the snapshot that made them. Canvas, game, Flutter, and custom-drawn apps often have none or a thin one; that is normal, not a reason to stop.
The loop
launch_app, then get_window_state, then look (the screenshot always, the tree when there is
one), act, and look again to confirm the effect. A click reports no effect by itself. A verdict
rests on what was seen after the action: a verify_state result, a value in the tree, or a
screenshot that shows it.
- Background input first. Use
delivery_mode: "foreground"only when background input has no effect or returnsbackground_unavailable, and say in the report that it took focus. verify_statematches only actionable elements; read static labels fromget_window_state. Adegradedtree or anuntrusted_sourceresult cannot be trusted alone; confirm with a fresh screenshot.- Electron and web content inside an app: list selection and typing need foreground delivery, and field text is not in the tree, so read it from the screenshot.
- Under WSL the driver is a Windows program: give it Windows paths (
wslpath -w <path>).
Evidence
Write every screenshot_out_file into the evidence directory the prompt names, one before
and one after each checked action, named by step. Keep the verify_state output when there is a tree.
Gotchas
- On Windows,
launch_appfor a Store (UWP) app returns the pid ofApplicationFrameHost, which other apps share. Close such an app through its window's Close button, neverkill_app. - Elevated apps refuse input from a non-elevated driver.
- When the daemon is gone or every call fails, stop using computer use, say so in the report, and mark the affected items "not checked" with the error. When one control fails while others work, try the other ways in, in order: a background click on its element, a foreground pixel click from a fresh screenshot of the app's main window, then the keyboard. Name each way tried in the report.
- Close the apps you launched before ending, so nothing is left open on the user's desktop.
- The user might be interacting with their desktop, so if unexpected things happen that might also be the cause.
04 同仓库更多 Skills
软件界面查看与真实操作
using-software
像真实用户一样查看和使用软件以进行检查:可以是已打开并登录的浏览器、某个环境(universe)中的浏览器、agent-browser、computer use(计算机使用)、用于 CLI 的终端,或用于原生或移动应用的测试工具。用于选择如何驱动应用并查看用户实际看到的内容。
using-browser
Drive a web app's real UI in a headless browser through the agent-browser CLI: open pages, read them, click and type, and screenshot them. Use for any software with a web UI.
软件运行实例访问定位
reaching-software
在以用户身份检查软件时,访问软件实际运行的位置:本地进程、已部署的站点、本机或其他机器上的 Digital Twin Universe,或尚未运行的应用。当应用、智能体和用户视图可能位于不同机器上,或 URL 没有响应时使用。
软件检查证据收集
gathering-evidence
决定在检查软件时应记录哪些证据(适用于 Web、CLI、桌面和移动应用),以及如何命名和存储这些证据,以便报告能够指向它们。在任何结论必须基于所记录内容而非声称内容的检查之前和期间使用。
应用真实体验验证
reality-check
检查应用是否按真实用户的体验方式工作,并为每一项发现返回证据。可通过命令行 `reality-check` 驱动,或通过 Python 的 `reality_check.lib` 使用。每当需要验证某个修复或功能时使用:在修复 bug、构建或更改功能后,于报告工作完成之前运行一次检查,使报告说明用户实际能做什么,而不仅仅是代码或测试所暗示的。当被要求检查、验证或确保应用正常工作,以及用户直接提到“reality check”时,也应使用。