Webdriver, TeamCity screen size issues on agent

2,203 views
Skip to first unread message

Moises Siles

unread,
Oct 10, 2012, 1:44:51 AM10/10/12
to webd...@googlegroups.com
Hi all,

Sorry for this question, I feel that this is more a Team City question. So, I have been working with webdriver 2.25 and C# pretty much using Firefox 14, and I running my scripts using TeamCity, and here is my case

The problem that I'm seeing is that my scripts are being affected by screen resolution issues, when I run my scripts manually in the same box that the team city agent is running they are ok, but when the Team city agent runs the scripts automatically they will fail, the issue is because there are some scripts that are using point X and point Y to execute drag and drop actions.

When I ran the scripts manually these are the window dimensions

INFO 2012-10-10 12:21:22 – MaximizeWindow is being executed
INFO 2012-10-10 12:21:22 – Windows Size: {Width=932, Height=904}
INFO 2012-10-10 12:21:22 – Windows Size H: 904
INFO 2012-10-10 12:21:22 – Windows Size W: 932
INFO 2012-10-10 12:21:22 –
INFO 2012-10-10 12:21:22 – Size After Maximize the Window
INFO 2012-10-10 12:21:22 – Windows Size: {Width=1912, Height=922}
INFO 2012-10-10 12:21:22 – Windows Size H: 922
INFO 2012-10-10 12:21:22 – Windows Size W: 1912

When the team city agent ran the scripts these are the values

INFO 2012-10-10 12:24:19 – MaximizeWindow is being executed
INFO 2012-10-10 12:24:19 – Windows Size: {Width=994, Height=758}
INFO 2012-10-10 12:24:19 – Windows Size H: 758
INFO 2012-10-10 12:24:19 – Windows Size W: 994
INFO 2012-10-10 12:24:19 –
INFO 2012-10-10 12:24:19 – Size After Maximize the Window
INFO 2012-10-10 12:24:19 – Windows Size: {Width=1032, Height=776}
INFO 2012-10-10 12:24:19 – Windows Size H: 776
INFO 2012-10-10 12:24:19 – Windows Size W: 1032

I would expect that the Team city agent use the same window size, but I'm not sure if the agent will use a default value or if we can set this somewhere.

Regards

darrell

unread,
Oct 10, 2012, 10:27:46 AM10/10/12
to webd...@googlegroups.com
I use Selenium but not TeamCity., When I set the window size via Selenium I have complete control over the size. If I want full screen, I query the system via javascript to find out the screen size, position the window to (0,0) then expand it to the screen size. There is no way, in Selenium, to trigger the Windows control for resizing the window to "Maximize". So if manual versus automated gives you different window sizes, I would look at TeamCity.

I do know that it is possible for the profile (user?) I use manually and the profile the automation uses to be different. If you launch the automation in debug mode and set a breakpoint, it should be the same as the automation running without intervention. This is how I debug things. I use the same scripts for my local workstation as I do for deploying on the test environment. Both environments need to be as economical close to production as possible.

Moises Siles

unread,
Oct 10, 2012, 2:00:40 PM10/10/12
to webd...@googlegroups.com
Thanks Darrel for you answer, my Teamcity server is in the same box that I'm use to code my scripts..... but the thing that I found is that the TeamCity agent is using a different resolution that the real one, so probably I'll research about how the agents are working.... 

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/ru-27UYq2uoJ.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.

Moises Siles

unread,
Oct 12, 2012, 12:45:49 AM10/12/12
to webd...@googlegroups.com
Hi Darrel,

Just to share that I found the solution, I saw this post in TeamCity forums

"TeamCity doesn't handle UI.  My guess is you're running a windows build agent as a service.  Windows services have no access to the console though, so this will get you nowhere.  To get around this, on the agents where we want to run GUI tests, we run TeamCity in console mode.  Simply run agent.bat (in the TC bin folder) with the parameter start (or stop to stop the agent).  Of course, you'll have to leave a desktop session open for this to work properly...

good luck.

ray"


With this one it will use the same session that I'm using.

Regards

On Wed, Oct 10, 2012 at 8:27 AM, darrell <darrell....@gmail.com> wrote:
--

darrell

unread,
Oct 12, 2012, 10:41:55 PM10/12/12
to webd...@googlegroups.com
Glad you found the solution. As a security concern, you shouldn't leave the console open. You might even find that some IT departments will have a policy against this.

What you can do is rather than leaving your computer unlocked, install VirtualBox or VMWare Player on your computer then run everything inside a virtual computer. You can then leave the virtual computer unlocked and automatically logged in (have a look at http://darrellgrainger.blogspot.ca/2012/07/automatic-log-in-automatic-run.html) but leave your real computer locked.

Darrell
Reply all
Reply to author
Forward
0 new messages