Tuesday 5 January 2021

Can you set a screen size and use pyautogui / selenium chrome driver without a monitor

Does anyone know how to force pyautogui or python in general to recognize a set screen size and take in display data, even if no display is connected?

I have a task that uses pyautogui, and selenium chrome driver, which both require a display, or they fail.

It runs on a server, so the start of the program requires my laptop to remote desktop into the server, allowing it to have a display, which allows launching a page with chromedriver, and pyautogui click components / screen search to work.

The issue arises that should my home network ever be down, it cannot kick off the remote desktop, and therefore my automation would fail.

My solution would be to emulate or force the program to behave as if a display existed, so it can just be run server side.

All of my servers are windows, so XVFB does not seem to be an option based on Xvfb on Windows



from Can you set a screen size and use pyautogui / selenium chrome driver without a monitor

No comments:

Post a Comment