How to Maximize the Browser Window in Selenium Webdriver (Selenium 2) Using C#

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

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

Open browser window in full screen using Selenium WebDriver with C#

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

isn't that simple?

Maximize browser window for Firefox with Selenium WebDriver C#

For Firefox use -

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

You can check this link for more details - How do I maximize the browser window in Selenium WebDriver (Selenium 2) using C#?

How to get browser window front while running the test using selenium C#?

If while running script any new opened window is not active then you can use

getDriver().switchTo().window("your window name");


Related Topics



Leave a reply



Submit