pywinauto icon indicating copy to clipboard operation
pywinauto copied to clipboard

MaterialDesign WPF combo box raises an exception in Select(...) by index

Open vasily-v-ryabov opened this issue 4 years ago • 0 comments

The problem was reported in Russian Gitter chat a while ago.

Demo application: https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/tree/master/MainDemo.Wpf

Short Example of Code to Demonstrate the Problem

Select by string is working. But the following code:

em.child_window(auto_id='Combobox.WD', control_type='ComboBox').select(1)

raises exception:

Traceback (most recent call last):
  File "C:\Python\Python38\lib\site-packages\pywinauto\controls\uia_controls.py", line 238, in select
    self._select(item)
  File "C:\Python\Python38\lib\site-packages\pywinauto\controls\uiawrapper.py", line 676, in _select
    wrp.iface_selection_item.Select()
_ctypes.COMError: (-2146233083, None, (None, None, None, 0, None))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Python/Projects/automation/index.py", line 86, in <module>
    em.child_window(auto_id='Combobox.WD', control_type='ComboBox').select(1)
  File "C:\Python\Python38\lib\site-packages\pywinauto\controls\uia_controls.py", line 266, in select
    self.collapse()
  File "C:\Python\Python38\lib\site-packages\pywinauto\controls\uia_controls.py", line 162, in collapse
    if not self.is_expanded():
  File "C:\Python\Python38\lib\site-packages\pywinauto\controls\uiawrapper.py", line 561, in is_expanded
    state = self.get_expand_state()
  File "C:\Python\Python38\lib\site-packages\pywinauto\controls\uia_controls.py", line 188, in get_expand_state
    return super(ComboBoxWrapper, self).get_expand_state()
  File "C:\Python\Python38\lib\site-packages\pywinauto\controls\uiawrapper.py", line 556, in get_expand_state
    return self.iface_expand_collapse.CurrentExpandCollapseState
_ctypes.COMError: (-2146233083, None, (None, None, None, 0, None))

Specifications

  • Pywinauto version:
  • Python version and bitness:
  • Platform and OS:

vasily-v-ryabov avatar Apr 19 '20 18:04 vasily-v-ryabov