python-3.x - 使用 pywinauto 的检查工具中的数据
问题描述
我正在努力自动化一个名为 MEmu Instance Manager 的应用程序。
对于我的项目,我想使用 pywinauto 模块和 windows 工具包中的检查工具返回存在的实例数量以及它们的名称。
基于 Inspect 工具,逍遥应用的结构如下
MainWindow
Parent
Child1
InstanceArea
TARGET
WIDGETS
当使用检查工具检查目标小部件时,这就是我得到的。
我要返回的字符串是“b__”
如何使用 python 返回Legacy|Accessible.Value
字符串?在执行此操作之前是否需要指定小部件的路径?
如果是这样,怎么做?我已经阅读了很多关于 pywinauto 指南的有用信息,但是我无法在 MEmu 上应用我从检查中获得的信息。
例如,
使用上述信息,我无法通过提供的信息参考此窗口。
我是一个初学者,我已经为此工作了几天,但毫无进展。请帮助*哭泣
解决方案
可能这种方式应该有效:
from pywinauto import Application
app = Application(backend="uia").connect(title='MainWindow')
# app.MainWindow.dump_tree() # useful to get child_window spec for just a copy-paste!
target = app.MainWindow.child_window(title='TARGET', control_type='Edit').wrapper_object()
# maybe try control_type='Text' depending on info from Inspect.exe
# when you found the control, just get the text
target.legacy_properties()['Value'] # .legacy_properties() returns a dict
我没有用真实的应用程序实例检查它。希望你可以调整它的边缘。
推荐阅读
- powershell - 在远程计算机上执行 Powershell 代码,然后在本地计算机上使用结果
- php - Kartik Select2 返回 null
- android - Firebase ML 套件:预训练模型
- php - Wordpress – 按元值按字母顺序对帖子进行排序
- bamboo - Bamboo 不会在计划中自动创建分支
- java - 如何在 JScrollPanel 中添加 JPanel,然后再次添加 JPanel?
- javascript - 提交错误的表单时网页刷新到顶部
- android - 使用 angular 与 angular-nativescript 组件有什么区别
- ruby-on-rails - 如何存储加密数据?
- java - 有没有办法在不区分大小写的情况下比较 2 个字符串?