Selenium - change resolution on node service
I solved the issue.I am using a Virtual Machine over VMware ESX.
First of all I noticed that when logging in through the console and trying to change the resolution, the maximum resolution was quite smaller than expected.
To maximize the max resolution I followed this VMware KB.
Now, change the default resolution by editing registry values:
Navigate to:
HKEY_CURRENT_CONFIG\System\CurrentControlSet\Control\VIDEO\{Address of primary video card}\0000\
Find
DefaultSettings.XResolution
That is your X axis. Edit as a Decimal to what you want it to be. IE 1152.Find
DefaultSettings.YResolution
. That is your Y axis. Edit as a decimal to what you want it to be. IE 863.Restart, and you're done.
In addition, make sure your Selenium node
runs as Local System with Allow service to interact with desktop
.
Now you may change chrome window resolution via your code:
Driver.set_windowsize(x,y)
Think that is a service limitation, we had issue like that, solution was to start node from command line.
- Connect to remote machine
- Start node from command line
- Close connection (not by logging out, but by clicking 'X' button)
This way you'll leave your session hanging, if you want this command to be executed automatically you may try and add batch file to your startup.