OS : windows 11, pywinauto v 0.68
I need to automate a program with these procedures:
- Open app
- click "particular adjustment mode" button
- click "model name" dropdown menu and press L350
- Select "printer information check" on listbox
- press "check button"
- Press "save button"
- save as current date on the popup save as menu
The 5th step is the part where i'm stuck, i cannot identify the controls or access the push buttons. whenever i try to identify the controls i get "AccessDenied: [WinError 1400] Invalid window handle. Cannot get process ID from handle."
It's probably because the name of the child window is the same with main window. I checked with swapy and it seems to be the case. There are 2 windows with the same title
from pywinauto.application import Application
import time
import pyinspect as pi
app = Application().start(r"C:\resetter\adjust.exe")
window=app.Dialog
time.sleep(1)
app = Application().connect(title=u'model = (not selected) | port = Auto selection | AdjProg Ver.1.0.0')
app.Dialog.Button3.click()
time.sleep(2)
app = Application().connect(title=u'Adjustment Program')
window.combobox.select(3)
time.sleep(2)
#window.PortComboBox1.select(1)
#time.sleep(2)
app.Dialog.Button3.click()
window.listbox.select(23)
time.sleep(2)
app.Dialog.Ok.click()
time.sleep(4)
app = Application().connect(title=u'model = L350 | port = Auto selection | Adjprog Ver.1.0.0')
This would give error :
ElementNotFoundError: {'title': 'model = L350 | port = Auto selection | Adjprog Ver.1.0.0', 'backend': 'win32', 'visible_only': False}
I have tried
app.Application().child_window(title=u'model = L350 | port = Auto selection | Adjprog Ver.1.0.0').checkbutton.click()
But it's still the same