I'm using TFS 2015 to trigger Selenium automated test suite. Few of test cases are failing due to some HTML elements get overlapped and this happens due to the screen resolution of the session which TFS service account opens is smaller (Programmatically I took screenshots while running the test methods in TFS). All the test cases are passing when I run from Visual Studio or through CMD locally or Remote Desktop session in TFS server.
I tried increasing the screen resolution using bellow techniques , but still screenshots saved in TFS server shows smaller screen size.
- Increase the window size :
driver.Manage().Window.Size = new Size(x, y);
- Chrome capabilities - Resolution
DesiredCapabilities caps = new DesiredCapabilities();
caps.SetCapability("resolution", "1920x1080");
- Chrome capabilities - Window Size
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.AddArgument("--window-size=1300,1000");
- Maximize the window
driver.manage.window.maximize();
None of these approaches works since the screen resolution of the session which TFS service account opens is smaller.
When I run the test cases with Headless option, browser windows opens with Maximum window size but test fails since selenium can't identify the elements (NoSuchElementException) :
var chromeOptions = new ChromeOptions();
chromeOptions.AddArguments("headless");
(Project which I'm automating is a ReactJS project)
I would like to know a way to increase the screen size when test are being executed form TFS agent. Thank You