Open bernd-wechner opened 3 years ago
For what it's worth I changed the output locally to:
warnings.warn('COMError: {} while setting focus on: {} {}'.format(hex(exc.hresult & 0xffffffff), self.element_info.control_type, self.element_info.name), RuntimeWarning)
which is much more useful to me. I can see the COM error code, I can see what element it was trying to focus.
Alas self.element_info
does not have a very good __repr__
here as it leaves out the control_type
.
@bernd-wechner Did you find any solution for this issue. I am seeing same issue while trying to access popup menu item.
Trying to access popup menu item throws below error RuntimeWarning: Can't get elements due to COM error: (-2147467259, 'Unspecified error', (None, None, None, 0, None)). Try to set pywinauto.windows.uia_element_info.UIAElementInfo.use_raw_view_walker = True
If I try setting UIAElementInfo.use_raw_view_walker = True, it throws below error RuntimeWarning: Can't get descendant elements due to error: (-2147467259, 'Unspecified error', (None, None, None, 0, None))
I admit this was some while ago and I can't rightly recall. That said I don't think I did ever work out what's going on here and worked around it by running the automation on another machine (but my desktop) so that my use of the desktop could not interfere with the automation run in any way.
Expected Behavior
No warning. And/or better feedback and understanding of what is going on.
Actual Behavior
I start my app with pywinauto, and get the top window, then I carry on automating fetch the menus and toolbars and starts on my merry way. It's working quite well. But my output is polluted often, with one instance and one instance only, and usually early around the time top_window is fetched not long after mostly and sometimes later, with a message that reads:
I can see that this is generated by
set_focus()
inuiawrapper.py
but says nothing of utility.FIxes I would recommends, might include:
Steps to Reproduce the Problem
Not 100% sure it's easy to reproduce as it could be very contextual to this app, my platform whatever. it's a COM error after all. And an unspecified one. I do have a feeling, not a knowing, just a feeling that it arises then and when I interact with the PC while my automation script is running. If I stand back and let it do it's work, and don't touch my PC I don't see this warning (I think). If I continue to do something on the side, my automation actually works fine, nothing fails, every now and then it grabs my mouse pointer and whisks it away to click some menu on my app on the other monitor, but on the whole it all works fine. I don't do this often, but I am often doing a quick interaction moving a window after I started it ...
Specifications