-
Notifications
You must be signed in to change notification settings - Fork 687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change UIA backend to use RawViewWalker instead of FindAll #1001
Conversation
Use iter_children for avoid code duplication
Debug prints, need testing and performance optimizations.
It previously received all descendants tree, and then filtered it. Usually appears on Qt apps.
RawTreeWalker finds more elements than FindAll method. This causes tests failure because best_match prefers a Pane element instead of Static.
I tried to compare the performance of both methods and got the following results: Test application: modified widgets\mainwindows\mainwindow example from Qt5 with number of dock windows and nested groupboxes specified via command line arguments Window with 7 children elements, average tree depth 2
Window with 12 children elements, average tree depth 7
Window with 67 children elements, average tree depth 62
Source of used benchmarks located here |
Codecov Report
@@ Coverage Diff @@
## atspi #1001 +/- ##
==========================================
- Coverage 95.06% 89.20% -5.86%
==========================================
Files 58 58
Lines 22100 22037 -63
==========================================
- Hits 21009 19659 -1350
- Misses 1091 2378 +1287 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good fix. I just had a quick go through.
because original method won't be restored if test asserts and it may affect to other tests
@eltimen thanks for measurements! Please create a Wiki page with these numbers and put a link on it here. |
https://github.com/pywinauto/pywinauto/wiki/Performance-measurements-(draft) |
In pywinauto#207, the `cache_enable` argument was added to the constructor, propagating to `children` and `descendants`. However, when `iter_children` and `iter_descendants` were introduced in pywinauto#475, `cache_enable` wasn't implemented to propagate. From reviewing past issues and PRs, it appears that not propagating `cache_enable` was unintentional and simply overlooked. pywinauto#1001 and pywinauto#1012 refactored the code without changing the current behavior, resulting in a complex conditional implementation.
In pywinauto#207, the `cache_enable` argument was added to the constructor, propagating to `children` and `descendants`. However, when `iter_children` and `iter_descendants` were introduced in pywinauto#475, `cache_enable` wasn't implemented to propagate. From reviewing past issues and PRs, it appears that not propagating `cache_enable` was unintentional and simply overlooked. pywinauto#1001 and pywinauto#1012 refactored the code without changing the current behavior, resulting in a complex conditional implementation.
Methods
children()
anddescendants()
of the UIAElementInfo changed to useIUIAutomation::RawViewWalker
instead ofIUIAutomationElement::FindAll
.This allows to find more elements than FindAll returns (for example, solves the problem mentioned in #644)
Related issues #644 #696