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
Fix for #399-top_window() should work on minimized application #580
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #580 +/- ##
==========================================
- Coverage 95.69% 95.67% -0.03%
==========================================
Files 49 49
Lines 20130 20132 +2
==========================================
- Hits 19264 19261 -3
- Misses 866 871 +5 |
if windows: | ||
break | ||
time.sleep(Timings.window_find_retry) | ||
timeout -= Timings.window_find_retry | ||
only_visible_windows ^= True |
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.
Bitwise operation on a bool variable looks a little bit strange. It seems the loop iterations are altered by True
and False
values. It looks like a lottery or stochastic algorithm. I'd prefer something more explicit and clear. One of my thoughts were to remove top_window()
method at all because it adds a lot of confusion when real top window is changing. It returns WindowSpecification with the handle at some moment and re-usage of this specification confuses a lot.
I think this issue should be solved after we implement an ability to create child window specifications from wrapper object as a parent in search criteria. So that top_window()
could return a wrapper object.
Another possible way is to have top_wrapper()
and top_window()
equivalent to .window(top_level_only=True, found_index=0)
. But for UIA backend the meaning of top window is different because top window can be a child of main form. So it can be backend specific and therefore removed from Application
object which is backend agnostic.
What do you think?
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.
As per your comment, I see three possibilities:
- To remove top_window()
- Solve the issue after implementing a feature to create child window specifications using parent in search criteria
- Make the top_window backend specific and remove it from Application class.
IMO, decision has to be made based on the amount of time and effort needed. Is it worth the effort? If you ask me I would simply say we get rid of top_window in future releases as I never use top_window() in my tests for the same reasons you mentioned above.
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.
I think point (1) is not good for coming 0.6.6. The second way is the most preferable for me. For the third one it shouldn't be removed from Application
, but may call or contain backend-specific parts inside. I don't think the third way is worth efforts.
No description provided.