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

getWindowsWithTitle and getActiveWindow return None when running on virtual frame buffer #92

Closed
klapnek opened this issue Aug 31, 2024 · 3 comments

Comments

@klapnek
Copy link

klapnek commented Aug 31, 2024

Hi,

Thank you very much for your efforts on making "pygetwindow" to run on Linux.

We are working on a CI/CD pipeline including automated UI testing, where we run our UI alongside robot framework and communicate
with it through the UI's API, verifying screenshots and check if texts in all translations fit within their bounds. Further more, we use pyWinCtl and pyautogui to actually control the UI and test its functionality.

I'm happy to report that it runs from both the PowerShell as well as from Ubuntu WSL2 on my Windows machine. What I really would like though, is to be able to run it on our build server on a virtual framebuffer, using Xvfb.

Unfortunately, at the moment, when running our script on a virtual framebuffer ($ xvfb-run ./application.py) it does start the application (we know, because verifying the screenshots works), but when we try to get the window handle, getWindowsWithTitle(name) and getAllAppsNames() return an empty list, and getActiveWindow() returns None.

Do you think it is possible to get it to work under Xvfb?
I maybe able to contribute, if you can tell me where to look next. I'm kinda running out of ideas.

I have tried running it on Xvfb under WSL2, as well as on a native Linux machine (our build server). The main goal is to be able to run it on our build server, if it would also work under WSL2, that would be even more pleasurable.

Thanks in advance.

@klapnek
Copy link
Author

klapnek commented Aug 31, 2024

Now that I think about it, of course the window list is empty. I run my application on a virtual framebuffer, not a virtual window manager. No window manager: No windows!

Sorry for bothering you.

@klapnek klapnek closed this as completed Aug 31, 2024
@Kalmat
Copy link
Owner

Kalmat commented Sep 1, 2024

Thank you so much for your interest, and my apologies for my late reply.

Unfortunately I don't know Xvfb, but googling around shows there is no Xserver to query. You're likely right: no window manager, no windows.

Have you tried using these commands?

DISPLAY=:1 wmctrl -l
xwininfo -root -tree

If any of these commands has a valid output, perhaps you can parse it.

Keep it up!

@klapnek
Copy link
Author

klapnek commented Sep 1, 2024 via email

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

No branches or pull requests

2 participants