3

I have developed a framework with selenium + .NET

I'm running all test using Bambo agent. Everything is working fine, except one thing. As you know, chromedrive can not set window size bigger than actual machine screen resolution.

My bamboo machine has set 1920x1080 resolution. To make sure that it is for real 1920x1080, I wrote a powershell script that is executed on agent berofe tests and print out resolution. Btw I have bamboo agent with Windows

But when webdriver start browser (chrome, firefox or IE) it limits the browser window size to 1044x788. Looks like the webdriver is getting wrong resolution from bamboo agent.

As you know webdriver is not allowing to set bigger size of window than you actual machine has. Thats why we limit browser size to 1044x788

There is no way to change size of window for bigger one. Things like: Manage().Window.Maximize() or Manage().Window.Size = new Size (1920x1080) or starting chrome with webdriver adding some options for chrome like: chromeOptions.AddArgument("--window-size=1920,1080"); it is always limited to 1044x788.

Did any one have similiar problem? Can I somehow "hack" webdriver to open browser with 1920x1080? Meaby somebody knows how webdriver is checking the screen resolution? If he is looking for resolution in some windows file then meaby I could inject 1920x1080 resolution there?

Or meaby there is some setting in bamboo agent that I missed?

Why is that important? Becouse at same point I faced problem that on this smaller browser some webelements sometimes are overlaping (figure out that on screenshots) and it case some test to fail.

When I run test on my laptop it always have this 1920x1080 resolution.

P.S. I know about Selenium Grid but my aproach works great for me, until now :)

Before second I wrote another powershell script and create a screenshot on bamboo machine, and the screenshot has 1024x768 resolution. So meaby it is coused somehow by machine..

vTad
  • 309
  • 2
  • 13
  • I have the exact same issue. I have been searching for an hour but haven't found anything yet. I will continue searching. – Yogesh Jindal Jun 02 '16 at 18:08
  • @YogeshJindal ok If you will find something please shere it with me. If I will find something I will let you know – vTad Jun 03 '16 at 07:55
  • did you find anything? Also, which version of windows are you running. I am running 2008. I am trying to see if I can upgrade it to 2012 – Yogesh Jindal Jun 03 '16 at 20:09
  • had the same issue chaps, if anyone is still checking this. I managed to make mine work via my question and answer: https://stackoverflow.com/questions/73118802/extend-windows-service-account-app-resolution-beyond-1024-x-768/73121691#73121691 – jjay225 Jul 26 '22 at 10:27

1 Answers1

2

I know the answer. Bamboo runs all tasks as windows service (not as a user). That's why I was not able to see the browser and the screen resolution was wrong. There are two solutions:

  1. Set up selenium grid hub and node on that one machine with your user, and paste url of hub in you framework. Then bamboo service will trigger selenium grid hub that is set by your 'user' and you will be able so see browser when you will log into the virtual machine and it wil have normal resolution (I have select this solution)

  2. I think that there could be another solution to set up bamboo to run tasks not as windows service but as a user (not sure if it is possible).

vTad
  • 309
  • 2
  • 13