Skip to content

Commit

Permalink
Fix ValueError on selecting item of Qt ComboBoxes
Browse files Browse the repository at this point in the history
  • Loading branch information
eltimen authored and vasily-v-ryabov committed Oct 9, 2021
1 parent 33bffe9 commit b42093d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pywinauto/controls/uia_controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,26 +307,26 @@ def select(self, item):
list_view.get_item(item).select()
# do health check and apply workaround for Qt5 combo box if necessary
if isinstance(item, six.string_types):
item = list_view.children(name=item)[0]
item_value = item.window_text()
item_wrapper = list_view.children(name=item)[0]
item_value = item_wrapper.window_text()
if self.element_info.framework_id == 'Win32':
if self.selected_text() != item_value:
item.invoke()
item_wrapper.invoke()
if self.selected_text() != item_value:
item.click_input()
item_wrapper.click_input()
elif self.element_info.framework_id == 'Qt':
list_view._select(item)
if list_view.is_active():
item.click_input()
item_wrapper.click_input()
else:
if self.selected_text() != item_value:
# workaround for WinForms combo box
item.invoke()
item_wrapper.invoke()
if self.selected_text() != item_value:
# workaround for Qt5 combo box
item.click_input()
item_wrapper.click_input()
if self.selected_text() != item_value:
item.click_input()
item_wrapper.click_input()
elif self.selected_index() != item:
items = children_lst[0].children(control_type='ListItem')
if item < len(items):
Expand Down

0 comments on commit b42093d

Please sign in to comment.