Skip to content

Commit

Permalink
Add RuntimeWarning suggesting to use RawViewWalker if FindAll fails
Browse files Browse the repository at this point in the history
  • Loading branch information
eltimen committed Dec 6, 2020
1 parent 53b3800 commit 665eeab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pywinauto/windows/uia_element_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,9 @@ def _get_elements(self, tree_scope, cond=IUIA().true_condition, cache_enable=Fal
try:
ptrs_array = self._element.FindAll(tree_scope, cond)
return elements_from_uia_array(ptrs_array, cache_enable)
except(COMError, ValueError):
ActionLogger().log("COM error: can't get elements")
except(COMError, ValueError) as e:
warnings.warn("Can't get elements due to COM error: {}. "
"Try to set pywinauto.windows.uia_element_info.UIAElementInfo.use_raw_view_walker = True".format(e), RuntimeWarning)
return []

def _iter_children_raw(self):
Expand Down

0 comments on commit 665eeab

Please sign in to comment.