Teamcity agent screen resolution

Hello all,

Is there a way to set/configure the screen resolution in a teamcity build agent. The build agent is a windows agent and teamcityagent runs as a service on that machine.

Many Thanks,
Aravind

9 comments
Comment actions Permalink

I have the same issue. Looks like nobody knows the answer!

0
Comment actions Permalink

Hi Steve,

 

This issue is *not* a TeamCity specific issue, but a Windows specific one. TeamCity is working as a service, which means that the system is starting up a session for it, controlling its screen resolution. In order to configure that, please check with the windows documentation.

 

This information here might help: https://stackoverflow.com/questions/41244411/selenium-change-resolution-on-node-service

0
Comment actions Permalink

I think that is a cop out. Firefox works fine from Windows when started manually. Problem only occurs when running from TeamCity. Therefore it IS a TeamCity issue. It is run as a WebService, which is headless.

0
Comment actions Permalink

Hi Steve,

 

I might not have explained myself correctly. The issue happens with TeamCity, but it's not an issue of TeamCity itself. When you open firefox from your own windows session, it inherits the environment of your session. When you run TeamCity as a service, you don't have a UI session, it's a service session. Firefox opened there thus is opened with that session, with different environment. This is because of how windows services work, and has nothing to do with teamcity. Steps on making it work are described in the stackoverflow question, as this is not an uncommon scenario, particularly for UI testing.

 

There is another workaround: Open a regular user session, stop the TeamCity agent service, open a command prompt and move to the build agent's folder. Run the build agent manually from the console. As long as that session remains open, the teamcity agent will inherit the environment of that session and it will be able to open firefox (or whatever) just fine. For making it work running the TeamCity agent as a service, you will need to modify the environment for the service as described previously.

 

Hope it's clearer now.

0
Comment actions Permalink

It looks like the solution provided by Nikita is no longer supported in windows 10 and windows server 2019.

Is there another way?

 

 

0
Comment actions Permalink

Nikita Rukavkov Hi Nikita, your solution is the one and working in my case. But the link doesnt work anymore. Could you post the solution here or send a link where it can be accessed? Thanks!

 

0
Comment actions Permalink

Nikita Rukavkov's link seems to work for me. I've copied her steps below for future reference if it is helpful to anyone. However, keep in mind this will not work in Windows 10 (1803 and later) as the Interactive Services Detection service has been deprecated and removed from Windows 10. Please see the relevant info from Microsoft here: https://social.technet.microsoft.com/Forums/windows/en-US/7266d107-08d1-4f53-ad7d-4cef3d67570d/missing-interactive-services-detection-in-windows10

As Denis Lapuente mentions, it is really a matter of running the agent from the console rather than as a service. If started from the console, the agent inherits the UI from the session. In Windows, you can start the agent from the console with the command <agent home>/bin/agent.bat start. For more information on running the agent from the console, please refer to Starting the Build Agent

 

1. Open services.msc. Open properties in teamcity agent service and check on checkbox Allow service to interact with desktop.

2. Open registry and change this key HKLM\SYSTEM\CurrentControlSet\Control\Windows\NoInteractiveServices to 0.


3. Change Interactive Service Detection start mode to auto and start it.
sc config UI0Detect start= auto
sc start UI0Detect


4. Connect to server using RDP.

5. Enter this text command in commandline rundll32 winsta.dll,WinStationSwitchToServicesSession. RDP session will broken but it’s ok.

Thats all. When you will run a new end2end tests you see that screen resolution will increase.

0

Please sign in to leave a comment.