I have an batch file that I execute that opens a program. A dialog box then appears which I type into it the username and password credentials
The I print the control identifiers and it lists;
SunAwtDialog - 'Login' (L528, T242, R853, B501)
['SunAwtDialog', 'LoginSunAwtDialog', 'Login']
child_window(title="Login", class_name="SunAwtDialog")
So after reading this post. My understanding was to use window + the button and a click method like so;
dlp.SunAwtDialog['Login'].click()
But this keeps throwing an ElementNotFoundError
;
ElementNotFoundError: {'best_match': 'SunAwtDialog', 'top_level_only': False, 'parent': <win32_element_info.HwndElementInfo - 'Login', SunAwtDialog, 2164976>, 'backend': 'win32'}
Below is the full snippet of code;
from pywinauto import application
import time
app = application.Application()
app.start(r"C:\\WINDOWS\system32\cmd.exe", wait_for_idle=False)
dlg = app.top_window()
dlg.type_keys('D:{ENTER}')
dlg.type_keys('cd{SPACE}Software\\client{ENTER}')
dlg.type_keys('run_client.bat{ENTER}')
time.sleep(10)
new_app = application.Application().connect(title="iManager")
dlp = new_app.top_window()
#type username + password
dlp.type_keys('user')
dlp.type_keys('{TAB}')
dlp.type_keys('pass')
#print control identifiers
dlp.print_control_identifiers()
#click login[![enter image description here][1]][1]
dlp.SunAwtDialog['Login'].click()
You can see on the image below the "Login" button I want to be able to click. There is also another button next to the "Server" option, but it is not in my control identifiers