Pywinauto control_type() 方法:获取控件类型
Pywinauto control_type() 方法
control_type() 方法是 Pywinauto 库中的一个方法,用于获取控件的类型。该方法返回一个字符串,表示控件的类型。
用法示例:
from pywinauto.application import Application
app = Application().start('notepad.exe')
dlg = app.top_window()
# 获取编辑框的控件类型
edit = dlg.Edit
ctrl_type = edit.control_type()
print(ctrl_type) # 输出 'Edit'
在上面的示例中,我们首先启动记事本应用程序,并获取它的顶级窗口。然后,我们使用 dlg.Edit 属性获取记事本窗口中的编辑框控件,并调用 control_type() 方法获取它的控件类型。在这种情况下,控件类型是 'Edit'。
原文地址: https://www.cveoy.top/t/topic/mBt8 著作权归作者所有。请勿转载和采集!