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

[Bug] An element is off-screen when two or more windows are opened after an application launch #57

Open
NeONRAcE opened this issue May 29, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@NeONRAcE
Copy link

Hi guys! I faced a problem while was trying to interect with an element

Pre-conditions

I have an app that launches 2 windows after its start (the second one is not actually a window because the window_handle is the same so it is like a part of the main window). Here is an example:
image

The "Select patient" window appears after the main window immediately.

Steps to reproduce from my side

  1. I'm filling in the patient's data and pressing OK
  2. The second window closes automatically (the window_handle is the same as well as the current_window_handle)
  3. I'm trying to interact with any element on the main form
  4. Facing the error below:
    response = {'status': 400, 'value': '{"value":{"error":"element not interactable","message":"Element with ID 2f7955c3-640c-4f2c-ab35-c477c122de49 is off screen","stackTrace":""}}'}

I also noticed that all elements have x:0, y:0 position, but they are enabled (checked with is_enabled method)

What can I do to fix the error above? Thank you! Please feel free to ask any details

Add.Info

I used to use WinAppDriver and everything worked correctly there. The needed element had a correct position

@aristotelos
Copy link
Collaborator

This behavior is because the element's property IsOffscreen is true. See the FlaUI.WebDriver source code.

This property is a Windows Automation property. Note the following lines:

The value of the property is not affected by occlusion by other windows

So could it be that the element is not scrolled into view? (Note that FlaUI.WebDriver also attempts to scroll the element into view as dictated by the WebDriver standard.)

Here is what the WebDriver2 standard says about "element not interactable".

If element's container is still not in view, return error with error code element not interactable.

I need to dive into this further with an attempt to reproduce it before I can say whether this is a bug, but if WinAppDriver behaves differently it would be nice to at least have the option to have WinAppDriver-compliant behavior.

@NeONRAcE
Copy link
Author

NeONRAcE commented Jun 4, 2024

bandicam.2024-06-04.19-09-58-475.mp4

Here is a small video describing my problem. The application launches and has two windows at the start. I successfully interact with the second window, but after it closes -- I can't interact with the main window. From my experience, it looks like the focus of the driver is still on the second window, but the process is general for both windows.

As you described above, I don't see any way to scroll anything because there aren't any scrolls at all.

P.S. As I mentioned -- the problem is weird because the needed button has X and Y coordinates set to 0, 0. Even if the IsOffscreen property is set to true -- the coordinates must be different from 0, 0

@aristotelos aristotelos added the bug Something isn't working label Jun 7, 2024
@grokys
Copy link
Contributor

grokys commented Jun 26, 2024

@NeONRAcE you might want to try using inspect.exe to take a look at the raw automation properties after you've manually triggered the repro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants