Having trouble automating some steps via pywinauto. It seems to not be able to open wbemtest (the process that needs automation).
My code is generated with 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()
The problem is that it seems to work with other applications (tested on potplayer), but with wbemtest I get the following error:
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.')
problem was that I was using python x86 version on 64-bit windows. had to switch wbem for sysnative to get it going