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

c#, selenium, selenium-webdriver

Solution

There's an outstanding issue to add this functionality to WebDriver, which can be tracked here: http://code.google.com/p/selenium/issues/detail?id=174

A workaround would be to use the `JavascriptExector` as follows:

public void resizeTest() {
    driver.Navigate().GoToUrl("http://www.example.com/");
((IJavaScriptExecutor)driver).ExecuteScript("window.resizeTo(1024, 768);");
}

Problem

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

Original source