question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting TypeError: UIAElementInfo object can be initialized with integer or IUIAutomationElement instance only!

See original GitHub issue

Hi,

I am new to Pywinauto and getting below error

Short Example of Code to Demonstrate the Problem

from pywinauto.application import Application
import time
import pyautogui

app=Application(backend='uia').start(r"C:\Program Files (x86)\blue8\client\B8Analyser.exe")
time.sleep(5)
app=Application(backend='uia').connect(title='Main Window',timeout=10)

w1 = app.window(best_match='Main Window').wrapper_object()
w2 = app.window(handle=w1)
ctrl = w2['TreeView']

c1 = ctrl.get_item([u'xd Explorer', u'Annotation_AugCrime']).click_input(button="left", double=True)
c2 = c1.sub_elements()

getting below error at c1 line:

TypeError: UIAElementInfo object can be initialized with integer or IUIAutomationElement instance only!

Specifications

  • Pywinauto version: 0.6.8
  • Python version and bitness: 3.8.2
  • Platform and OS: windows 10

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
bharatrajscommented, Jul 2, 2021

Hi Vasily,

please find below full traceback of the error

Traceback (most recent call last):
  File "C:/Users/bharatraj.shetty/PycharmProjects/test111/venv/testFiles/test7.py", line 13, in <module>
    c1 = ctrl.get_item([u'xd Explorer', u'Annotation_AugCrime']).click_input(button="left", double=True)
  File "C:\Users\bharatraj.shetty\PycharmProjects\test111\venv\lib\site-packages\pywinauto\application.py", line 379, in __getattribute__
    ctrls = self.__resolve_control(self.criteria)
  File "C:\Users\bharatraj.shetty\PycharmProjects\test111\venv\lib\site-packages\pywinauto\application.py", line 250, in __resolve_control
    ctrl = wait_until_passes(
  File "C:\Users\bharatraj.shetty\PycharmProjects\test111\venv\lib\site-packages\pywinauto\timings.py", line 436, in wait_until_passes
    func_val = func(*args, **kwargs)
  File "C:\Users\bharatraj.shetty\PycharmProjects\test111\venv\lib\site-packages\pywinauto\application.py", line 203, in __get_ctrl
    dialog = self.backend.generic_wrapper_class(findwindows.find_element(**criteria[0]))
  File "C:\Users\bharatraj.shetty\PycharmProjects\test111\venv\lib\site-packages\pywinauto\findwindows.py", line 84, in find_element
    elements = find_elements(**kwargs)
  File "C:\Users\bharatraj.shetty\PycharmProjects\test111\venv\lib\site-packages\pywinauto\findwindows.py", line 181, in find_elements
    return [backend_obj.element_info_class(handle), ]
  File "C:\Users\bharatraj.shetty\PycharmProjects\test111\venv\lib\site-packages\pywinauto\uia_element_info.py", line 75, in __init__
    raise TypeError("UIAElementInfo object can be initialized " + \
TypeError: UIAElementInfo object can be initialized with integer or IUIAutomationElement instance only!
0reactions
vasily-v-ryabovcommented, Feb 20, 2022

@bharatrajs sorry for long waiting but I see that the error message is NOT from my branch. Can you please try with my branch again?

pip uninstall -y pywinauto
pip install https://github.com/vasily-v-ryabov/pywinauto/archive/refs/heads/uia_elem_init_crash.zip

After installing my branch, please run your test and provide full traceback.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting TypeError: UIAElementInfo object can be initialized ...
Getting TypeError : UIAElementInfo object can be initialized with integer or IUIAutomationElement instance only.
Read more >
Getting TypeError: UIAElementInfo object can be initialized with ...
Getting TypeError : UIAElementInfo object can be initialized with integer or IUIAutomationElement instance only! Hi,. I am new to Pywinauto and getting below ......
Read more >
python/10658/pywinauto/pywinauto/uia_element_info.py
raise TypeError( "UIAElementInfo object can be initialized " + \. "with integer or IUIAutomationElement instance only!" ).
Read more >
Access Embedded Objects Using UI Automation
This topic shows how Microsoft UI Automation can be used to expose objects embedded within the content of a text control.
Read more >
Getting TypeError: UIAElementInfo object can be initialized with ...
pywinauto/pywinauto: Getting TypeError: UIAElementInfo object can be initialized with integer or IUIAutomationElement instance only!
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found