我正在尝试提取列"Assunto“上的列表文本,使用pywinauto从google chrome中的窗口弹出。
app = Application().connect(title_re='AgênciaNet', timeout=10)
time.sleep(1)
window = app.Chrome_RenderWidgetHostHWND
window.set_focus()
window.maximize()
window.print_control_identifiers()
控制标识符:
Chrome_WidgetWin_1 - 'AgênciaNet - Secretaria de Economia do Distrito Federal - Google Chrome' (L-8, T-8, R1032,
B736)
['AgênciaNet - Secretaria de Economia do Distrito Federal - Google ChromeChrome_WidgetWin_1', 'Chrome_WidgetWin_1',
'AgênciaNet - Secretaria de Economia do Distrito Federal - Google Chrome']
child_window(title="AgênciaNet - Secretaria de Economia do Distrito Federal - Google Chrome", class_name="Chrome_WidgetWin_1")
|
| Chrome_RenderWidgetHostHWND - 'Chrome Legacy Window' (L0, T71, R1024, B728)
| ['Chrome Legacy Window', 'Chrome Legacy WindowChrome_RenderWidgetHostHWND', 'Chrome_RenderWidgetHostHWND', 'Chrome Legacy Window0', 'Chrome Legacy Window1', 'Chrome Legacy WindowChrome_RenderWidgetHostHWND0', 'Chrome Legacy WindowChrome_RenderWidgetHostHWND1', 'Chrome_RenderWidgetHostHWND0', 'Chrome_RenderWidgetHostHWND1']
| child_window(title="Chrome Legacy Window", class_name="Chrome_RenderWidgetHostHWND")
|
| Chrome_RenderWidgetHostHWND - 'Chrome Legacy Window' (L0, T0, R1024, B657)
| ['Chrome Legacy Window2', 'Chrome Legacy WindowChrome_RenderWidgetHostHWND2', 'Chrome_RenderWidgetHostHWND2']
| child_window(title="Chrome Legacy Window", class_name="Chrome_RenderWidgetHostHWND")
|
| Intermediate D3D Window - '' (L0, T0, R1024, B728)
| ['AgênciaNet - Secretaria de Economia do Distrito Federal - Google ChromeIntermediate D3D Window', 'Intermediate D3D Window']
| child_window(class_name="Intermediate D3D Window")
我需要标签“名字”。任何人都可以帮我。泰!
规格:
发布于 2022-10-01 13:44:58
首先,请确保目标窗口在ProcessId
中具有相同的Inspect.exe
。如果进程与Chrome窗口不同,则需要连接或使用以下内容:
from pywinauto import Desktop
window = Desktop(backend="uia").window(title="Selecione um certificado")
window.child_window(title_re="MERCADAO COMERCIO.*", control_type="DataItem").click_input()
window.child_window(title="OK", control_type="Button").invoke()
为了更好地理解它的工作原理,我建议阅读入门指南。
如果这是页面上自己绘制的“窗口”,那么Chrome就有一个窍门:https://github.com/pywinauto/pywinauto/wiki/How-to-enable-accessibility-(tips-and-tricks)。
或使用此示例:drive.py
https://stackoverflow.com/questions/73896291
复制相似问题