Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

badari412
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Oct 10, 2018

Codecov Report

Merging #580 into master will decrease coverage by 0.02%.
The diff coverage is 100%.

@@            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
Copy link
Contributor

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?

Copy link
Contributor Author

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:

  1. To remove top_window()
  2. Solve the issue after implementing a feature to create child window specifications using parent in search criteria
  3. 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.

Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants