8

I''m building some Jave/Junit Selenium tests to work with both Chrome and Firefox.

I can't find any info on how to start the Firefox browser window in a maximised state. With Chrome I can use ChromeOptions, like:

anOptions.addArguments("--start-maximized");

I can't find any way to make the same thing happen for Firefox and FirefoxOptions.

Any suggestions?

user2868835
  • 1,250
  • 3
  • 19
  • 33

2 Answers2

2

For python with Firefoxyou can use:

driver = Firefox()
driver.maximize_window()
Pedro Lobito
  • 94,083
  • 31
  • 258
  • 268
1

Once you've started your test and used driver.get('http://your_url') to navigate to your desired URL, you can maximize the browser window by using the following command:

driver.manage().window().maximize();
AJC24
  • 3,280
  • 2
  • 19
  • 30
  • Yep - I understand that's an option, but I'd like to start the window in a maximised state. – user2868835 Mar 01 '18 at 11:17
  • 1
    I don't believe there is a way to do it through FirefoxOptions in a similar way to ChromeOptions? I'm open to correction on this but as far as I'm aware this is the only way to maximize the browser window in Firefox. – AJC24 Mar 01 '18 at 11:19