Start firefox browser in maximized form - Selenium Webdriver
I wanted to ask if there is a way in selenium webdriver to initiate the firefox driver in maximized form.
I know driver.manage().window().maximize(); will do the job, but with this the browser is opened in restored form and after couple of seconds it goes to maximized form. What I want is to open the browser in maximized instantly when my test runs. ChromeOptions works for chrome browser like following,
System.setProperty("webdriver.chrome.driver", "chromedriver.exe"); ChromeOptions options = new ChromeOptions(); options.addArguments("--start-maximized"); driver = new ChromeDriver(options);
Is there a similar way for firefox as well?
open your firefox manually and maximize it.
Close the browser.
open it again, it should open in maximize state, because firefox remembers the last opened state.
Now open the firefox from webdriver code, it should also start in maximize mode.
if the above is not happening, your firefox browser needs to be "refreshed". See this link https://support.mozilla.org/en-US/kb/changes-toolbars-and-window-sizes-are-not-saved