简体   繁体   English

pywinauto print_control_identifiers()不起作用

[英]pywinauto print_control_identifiers() doesn't work

Does anybody know the reason why I can't see full tree for Adobe AIR Setup Installer 有人知道我看不到Adobe AIR安装程序安装程序完整树的原因吗?

My code is: * for unknown reason I can not start app and see it, I need first start it, then check process ID, and after use "connect(process=ID)" or I have this error: 我的代码是:*由于未知原因,我无法启动应用程序并看到它,我需要先启动它,然后检查进程ID,然后在使用“ connect(process = ID)”之后出现此错误:

pywinauto.findwindows.ElementNotFoundError: {'best_match': 'AdobeAIRSetup', 'backend': 'uia', 'process': 3480} pywinauto.findwindows.ElementNotFoundError:{'best_match':'AdobeAIRSetup','backend':'uia','process':3480}

#app = Application(backend='uia').start(r'AdobeAIRInstaller.exe')

app = Application().connect(process=9880) 
app.AdobeAIRSetup.print_control_identifiers()

After that I can see result: 之后,我可以看到结果:

Control Identifiers: 控制标识符:

ApolloRuntimeContentWindow - 'Adobe AIR Setup' (L1163, T107, R1883, B754) ['ApolloRuntimeContentWindow', 'Adobe AIR SetupApolloRuntimeContentWindow', 'Adobe AIR Setup'] child_window(title="Adobe AIR Setup", class_name="ApolloRuntimeContentWindow") ApolloRuntimeContentWindow-'Adobe AIR设置'(L1163,T107,R1883,B754)['ApolloRuntimeContentWindow','Adobe AIR SetupApolloRuntimeContentWindow','Adobe AIR Setup'] child_window(title =“ Adob​​e AIR Setup”,class_name =“ ApolloRuntimeContentWindow”)

But there are no "I Agree" and "Cancel" button, that is why I can not click on it ! 但是没有“我同意”和“取消”按钮,这就是为什么我不能单击它!

Adobe安装程序窗口

检查我可以看到2个按钮

在此处输入图片说明

The solution with "import psutil" will help to obtain PID and send it to connect method! 使用“ import psutil”的解决方案将有助于获取PID并将其发送给connect方法!

from pywinauto import Application, Desktop

import psutil


PROCNAME = "Adobe AIR Installer.exe"
app = Application(backend='uia').start(r'AdobeAIRInstaller.exe')
apploaded = False


while apploaded == False:
    for proc in psutil.process_iter():
        if proc.name() == PROCNAME:
            print(proc.pid)
            app = Application(backend='uia').connect(process=proc.pid)
            apploaded = True

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM