Skip to content

Commit

Permalink
Fix find_elements when last enrty is '*'
Browse files Browse the repository at this point in the history
  • Loading branch information
dpratmarty committed Mar 15, 2024
1 parent df6ca69 commit d16bdd0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions pywinauto_recorder/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,22 +430,26 @@ def find_elements(full_element_path=None):
return []
window_candidates = filter_window_candidates(window_candidates)
if len(entry_list) == 1 and len(window_candidates) == 1:
if entry_list == ['*']:
return [window_candidates[0]]
title, control_type, _, _ = get_entry(entry_list[0])
if window_candidates[0].element_info.name == title and window_candidates[0].element_info.control_type == control_type:
return [window_candidates[0]]

candidates = []
title, control_type, _, _ = get_entry(entry_list[-1])
for window in window_candidates:
if is_regex_entry(entry_list[-1]):
if entry_list[-1] == '*':
eis = findwindows.find_elements(backend="uia", parent=window, top_level_only=False)
candidates += filter_with_match_entry_list(window.element_info, eis, entry_list)
elif is_regex_entry(entry_list[-1]):
eis = findwindows.find_elements(title_re=title, control_type=control_type, backend="uia", parent=window, top_level_only=False)
candidates += filter_with_match_entry_list(window.element_info, eis, entry_list)
else:
if control_type == "OCR_Text":
elif control_type == "OCR_Text":
candidates += find_ocr_elements(title, window, entry_list)
else:
eis = findwindows.find_elements(title=title, control_type=control_type, backend="uia", parent=window, top_level_only=False)
candidates += filter_with_match_entry_list(window.element_info, eis, entry_list)
else:
eis = findwindows.find_elements(title=title, control_type=control_type, backend="uia", parent=window, top_level_only=False)
candidates += filter_with_match_entry_list(window.element_info, eis, entry_list)
candidates = [UIAWrapper(ei) for ei in candidates]

if not candidates:
Expand Down

0 comments on commit d16bdd0

Please sign in to comment.