'How to send info to site about desktop resolution in Selenium?

I am developing an application and I need to send some info about the resolution of a browser's window and the resolution of a monitor.

The resolution is currently set to: 1920x1080. I want to send 800x600 as the resolution of the desktop.

Here's an example:

The desktop resolution is 800x600 and I set the chrome browser resolution to 480x320. I do this with the following snippet of code:

driver.Manage().Window.Size = new Size(480, 320);

How I can do this with Selenium? How can I properly send this info?



Solution 1:[1]

This is pretty straightforward now with Chrome. Just do the following:

ChromeOptions displayOptions = new ChromeOptions();
options.addArguments("--start-maximized");
driver = new ChromeDriver(displayOptions);  
//  Initialize your driver object here.
IWebDriver chromeDriver = new ChromeDriver("path to driver here", displayOptions);

This will initialize the driver object to be full-screen when it is instantiated.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Brian