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

cseleniumselenium-webdriver

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

Best Answer

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);