How to maximize the browser window in Selenium WebDriver (Selenium 2) using C#?

Reflux picture Reflux · Jul 6, 2010 · Viewed 284.1k times · Source

Is there any way to maximize the browser window using WebDriver (Selenium 2) with C#?

Answer

bipinkarms picture bipinkarms · Apr 26, 2012

driver.Manage().Window.Maximize();

This works for IE and Firefox. Chrome does not work. There is a bug submitted for this on ChromeDriver project.

Meanwhile, the get around for the chrome is to implement what Joey V. and Coder323 suggested.

ChromeOptions options = new ChromeOptions();
options.addArgument("--start-maximized");
driver = new ChromeDriver(options);