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?

Answers


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


Need Your Help

How do I change a div with the video's title when a relevant video is clicked?

javascript jquery html video youtube-api

I'm trying to have a div with the currently playing video's title change when a user clicks a relevant video (when the video ends), so that the correct title is displayed. The problem is, I don't see

Linux removing folders older than 1 year and more than 3 files

linux ant ssh find archive

I'm writing an ant script to clean up an archive folder