使用 pywinauto 自动化 wbemtest
Automate wbemtest with pywinauto
在通过 pywinauto 自动执行某些步骤时遇到问题。
好像打不开wbemtest(需要自动化的进程)。
我的代码是用 SWAPY 生成的:
from pywinauto.application import Application
app = Application().Start(cmd_line=u'"C:\Windows\System32\wbem\wbemtest.exe" ')
window = app.Dialog
window.Wait('ready')
button = window.Button
button.Click()
window2 = app.Dialog
edit = window2.Edit
edit.ClickInput()
edit.Select()
edit.DoubleClickInput('\securitycenter2')
button2 = window.Button7
button2.Click()
window3 = app.Dialog
edit2 = window3.Edit
edit2.ClickInput('\antivirusproduct')
button3 = window3.OK
button3.Click()
问题是它似乎可以与其他应用程序一起使用(在 potplayer 上测试过),但是使用 wbemtest 我得到以下错误:
Traceback (most recent call last):
File "C:\Users\Vali\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pywinauto\application.py", line 992, in start
start_info) # STARTUPINFO structure.
pywintypes.error: (2, 'CreateProcess', 'The system cannot find the file specified.')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/Vali/PycharmProjects/untitled/wsc.py", line 3, in <module>
app = Application().Start(cmd_line=u'"C:\Windows\System32\wbem\wbemtest.exe" ')
File "C:\Users\Vali\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pywinauto\application.py", line 997, in start
raise AppStartError(message)
pywinauto.application.AppStartError: Could not create the process ""C:\Windows\System32\wbem\wbemtest.exe" "
Error returned by CreateProcess: (2, 'CreateProcess', 'The system cannot find the file specified.')
问题是我在 64 位 windows 上使用 python x86 版本。必须将 wbem 切换为 sysnative 才能运行
在通过 pywinauto 自动执行某些步骤时遇到问题。 好像打不开wbemtest(需要自动化的进程)。
我的代码是用 SWAPY 生成的:
from pywinauto.application import Application
app = Application().Start(cmd_line=u'"C:\Windows\System32\wbem\wbemtest.exe" ')
window = app.Dialog
window.Wait('ready')
button = window.Button
button.Click()
window2 = app.Dialog
edit = window2.Edit
edit.ClickInput()
edit.Select()
edit.DoubleClickInput('\securitycenter2')
button2 = window.Button7
button2.Click()
window3 = app.Dialog
edit2 = window3.Edit
edit2.ClickInput('\antivirusproduct')
button3 = window3.OK
button3.Click()
问题是它似乎可以与其他应用程序一起使用(在 potplayer 上测试过),但是使用 wbemtest 我得到以下错误:
Traceback (most recent call last):
File "C:\Users\Vali\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pywinauto\application.py", line 992, in start
start_info) # STARTUPINFO structure.
pywintypes.error: (2, 'CreateProcess', 'The system cannot find the file specified.')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/Vali/PycharmProjects/untitled/wsc.py", line 3, in <module>
app = Application().Start(cmd_line=u'"C:\Windows\System32\wbem\wbemtest.exe" ')
File "C:\Users\Vali\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pywinauto\application.py", line 997, in start
raise AppStartError(message)
pywinauto.application.AppStartError: Could not create the process ""C:\Windows\System32\wbem\wbemtest.exe" "
Error returned by CreateProcess: (2, 'CreateProcess', 'The system cannot find the file specified.')
问题是我在 64 位 windows 上使用 python x86 版本。必须将 wbem 切换为 sysnative 才能运行