We use driver.manage().window().maximize();
to maximize the browser.
I have seen few examples online that are using driver.manage().window().maximize()
though it's not required to maximize the browser. (For Ex: gmail login)
Also I see on invoking browser using selenium it opens in maximized window only. Still I have to use this driver.manage().window().maximize();
Short answer: Yes.
Little longer answer: when selenium is interacting with the web page, like clicking on button or writing to text field, the interacted WebElement
must be visible, or you will get exception. If you think on performance calling one time to window().maximize()
is much 'cheaper' (and much less prone to errors) than scrolling to the WebElement
every time.
You gave Gmail login as example, but usually you need to do more than just login in tests project.
By the way
Also I see on invoking browser using selenium it opens in maximized window only
Is not true.