17

I'm trying to run a simple Watin test through TeamCity but the Internet Explorer window is never shown as is usually is via CruiseControl.

I get an error that it can't find a text field so something is running. But i can't see what without the window.

Is there a specific change to the setup of TeamCity server that I need to do?

Ruben Bartelink
  • 59,778
  • 26
  • 187
  • 249
Sammy Elal
  • 381
  • 2
  • 7

5 Answers5

20

Under Account tab on the Teamcity Agent's Service property window (services.msc), check "Allow service to interact with desktop", that will allow local service account to spawn internet explorer. But you will most certainly get stuck with other stuff, like cookie blocking, password saving etc. so login as local service and fix those stuff.

Easiest way to do that is with psexec (http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx), call psexec -i -s cmd.exe so spawn a cmd running as local account, then start internet explorer at setup everything up (the privacy settings in IE for local account is extremely high).

Ruben Bartelink
  • 59,778
  • 26
  • 187
  • 249
Carl Hörberg
  • 5,973
  • 5
  • 41
  • 47
  • This actually worked fine for me and enabled me to run Watin commands without resorting to running TeamCity from a command line. – Harv Oct 17 '11 at 19:22
  • Note: in order for this work, you really need to pay attention to Carl's comment about "like cookie blocking, password saving, etc". One more thing to add to that is making sure your domains are added to Trusted Sites. – Matt Jun 24 '13 at 20:43
  • Another thing: be careful if you are utilizing CORS at all... Local System does *not* like you using it with IE 9. You will most likely run into "access denied" type errors. I haven't yet found a way to get around it. – Matt Sep 12 '13 at 19:26
  • Why don't you just change the login user for the service to a local user on the system? – Marc Durdin Nov 05 '16 at 04:37
20

Found this on another forum

All credits go to Matt Baker

For future reference to anyone who attempts to run WatiN tests automatically using TeamCity. You must start your build agent using \bin\agent.bat start and NOT as a service. WatiN requires a full UI to execute properly and it doesn't get this environment as a service. I hope this makes it easier for other people!

joaquin
  • 82,968
  • 29
  • 138
  • 152
Sammy Elal
  • 381
  • 2
  • 7
  • Is there any chance you could elaborate on how to do this? I have a TC 4 server running with multiple builds, only one of which will be using WaTiN. Could you provide a more in-depth walk-through on how to do this? – brady gaster Mar 19 '09 at 18:56
  • 7
    this ain't true, a service can indeed use the full UI, check this answer: http://stackoverflow.com/questions/488443/running-watin-on-teamcity/3415992#3415992 – Carl Hörberg Sep 13 '10 at 07:33
  • @Ruben: Or you could also just google "Matt Baker Watin", c'mon y'all! :) http://devnet.jetbrains.net/message/5259538 – Wiebe Tijsma Nov 09 '11 at 14:07
  • @Zidad And then you edit what you so easily found into the answer above to save others the bother, wahey! – Ruben Bartelink Nov 11 '11 at 10:19
  • @Ruben them folks down here ain't giv'n me no edit privileges no more :) – Wiebe Tijsma Nov 13 '11 at 13:23
  • @Zidad The lazyweb has it sorted - it's lookin mighty fine now, thanks :D – Ruben Bartelink Nov 14 '11 at 08:37
3

If you installed as a service, make sure to stop it and disable it. Then, create a .bat file with the following

C:
cd teamcity\buildagent\bin\
agent.bat start

Now just create a shortcut in your start up folder to this batch file!

Manuel
  • 868
  • 1
  • 10
  • 21
2
  1. Stop agent service. execute command: net stop TCBuildAgent from console.
  2. Run from console c:\teamcity\buildagent\bin\agent.bat start (depending on your teamcity installation path)
ycseattle
  • 3,687
  • 7
  • 36
  • 42
0

Please try this simple solution: Go to services, edit the properties of your service, select the LogOn Tab, and check the box with the label: "Allow service to interact with desktop".

Worked for me in bamboo.

Cheers, Pedro O Moleiro