I have been running tests on a remote XP client for some time now. My tests are written in C# using Selenium’s WebDriver (Version 2.20.0) and the IE Driver (Version 2.20.1.0) with these tests being remotely run on a XP Client managed by Microsoft’s Lab Management.
My issue is that upon creating an IE Browser I am unable to maximise it on the Client through Selenium calls. Instead I am trying manually with the following:
_driver.Manage().Window.Size = new Size(System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width, System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height);
Along with WorkingArea I have also tried Bounds, but to no avail as both increase the window size but do not position it to the center correctly. I assume this is because a VM has no monitor and thus no way of knowing the actual resolution? I want to just call something that will ‘maximise’ the window to the full screen without specifying the size.
Since you are running the tests remotely and you need window to be re sized at client side. I would suggest you do it via JavaScript Injection.
The best thing…it executes on client side, so no worries. In JavaScript I moved the window to (0,0) axis first and then i maximized the window screen to Maximum available (Width, Height).
Here is code…in C#
I hope this helps…All the best