Unable to Maximize browser when running through Jenkins as windows service Unable to Maximize browser when running through Jenkins as windows service selenium selenium

Unable to Maximize browser when running through Jenkins as windows service


I had a problem similar to this when using Jenkins to run automated tests. It was to do with the interactive service detection.

The only way I could seem to fix this was to remove Jenkins as a windows service, and have it run from the CMD using a sciprt.


I have seen the same on TeamCity since it runs again as Windows service (on a virtual Desktop). After playing around with Firefox profiles, we had to use Full screen mode. Example code bellow (C#):

//Make Firefox fullscreen for TeamCity agent's runs_driver.Manage().Window.Maximize();((IJavaScriptExecutor)_driver).ExecuteScript("window.resizeTo(screen.width, screen.height)");_driver.Manage().Window.Position = new Point(0, 0);_driver.Manage().Window.Size =     new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);_driver.FindElement(By.CssSelector("body")).SendKeys(Keys.F11);_driver.Navigate().GoToUrl("about:blank");

Chrome also support such workaround.