I got an annoying issue here. My setup is as follows: Windows Server 2022 Data Center running as a VM in Azure. I have a windows service running that is using selenium Chrome Webdriver to open a local page and it exports a pdf from a button click. This works fine but the resolution of the pdf is terrible because the window size of the browser is only 1024 x 768 due to it being in a windows service context I've been reading, almost like a headless server with no screen.
Now I've tried:
- In my Chrome webdriver code to maximize the window, set various window sizes, nothing yet works for the windows service. (This works fine when not running as a windows service, the window sizes change accordingly)
- Been looking at registry entries such as ones from here: https://superuser.com/questions/990398/setting-display-resolution-beyond-1024x768-with-headless-windows-10
- I can simulate this behaviour on my local machine too
- Tried the "Allow service to interact with desktop" but no luck
- Ran Chrome Webdriver in "headless" mode but was causing issues with the export of the pdf, anyone know if this would allow setting your window size?
- Ran as a Scheduled Windows task, still runs at same 1024 x 768
- I've looked at SO's suggested similar questions
Obviously running this as As a Different User which is the service account works and the browser expands to maximized size but that's because it's not in a windows service context. I'm going to try run the app in a few different ways from a different app launching it running itself as a windows service account as in a new windows service trying to launch my current app.
Has anyone ever encountered or sorted out such an issue with locked resolution of 1024 x 768 while using a service account? Thanx all!