0

When we connect to a UIA backend window using pywinauto, getting element not found error.

Below is the code I have tried. When executing the uia backend application, and if the application is minimized I am getting the below element notfound error. Meantime if the application is running in background window with out minimized, everything works fine!!!

'''This part of code only for the testing purpose'''
    app = pywinauto.Application(backend="uia")
    app.connect(path="C:\xyz\Exe\Service\abc.exe")
    window = app.window_(title=u'abc')
    if window.is_minimized():
        window.restore()
    window.wait('ready', timeout=10)
    # window.print_control_identifiers()
    button = window.child_window(title="Ramping settings...")
    button.click()

    print("END-->Exec")



  Traceback (most recent call last):
  File "C:/Projects/TestAutomation/TBricks/Interface/UI/TBrickUIApp.py", line 124, in <module>
    if window.is_minimized():
  File "C:\Python27\lib\site-packages\pywinauto\application.py", line 367, in __getattribute__
    ctrls = self.__resolve_control(self.criteria)
  File "C:\Python27\lib\site-packages\pywinauto\application.py", line 248, in __resolve_control
    raise e.original_exception
pywinauto.findwindows.ElementNotFoundError: {'process': 7108, 'backend': u'uia', 'title': u'PPHSControl'}
Meister96Fels
  • 508
  • 1
  • 8
  • 26
kbk
  • 555
  • 2
  • 8
  • 20

1 Answers1

1

i understand that it is a mistake / parameter missed when i created the window handle.

window = app.window_(title=u'PPHS', visible_only=False).restore()

Above code will restore if minimized.

kbk
  • 555
  • 2
  • 8
  • 20