Full Screen Window In Selenium

Selenium fullscreen() method is used to full screen the browser window. It will perform browser full screen action same as real user full screen the browser window. May be sometimes you need full screen window in your selenium tests at that time this method will be very useful for you.

  • fullscreen() method is part of WebDriver.Window interface.
  • It's return type is void so it returns nothing.
  • It will full screen the browser window.
  • Syntax : driver.manage().window().fullscreen();
Below given example will show you how fullscreen() method is used to full screen the window size.

Selenium fullscreen method

Minimize window in selenium 

Selenium 4 has built in method to minimize the browser window. It is less used method in selenium but still you can use it if you want to minimize window in between selenium test. minimize() method will perform browser minimize user action. You can run your selenium tests in minimized browser mode and you can perform your other tasks beside.

  • minimize() method is part of WebDriver.Window method.
  • This method will return nothing because it's return type is void.
  • It will minimize the current working window if it is not already minimized.
  • It is helpful when your are performing manual testing or any other work as your selenium tests will be executed in minimized mode.
  • Syntax : driver.manage().window().maximize();

Selenium Minimize Window using minimize() method

Maximize window in selenium

You can maximize window in selenium using maximize() method. Every time you launch browser in selenium test, It will open browser window in small size. So maximize() is most commonly used method in selenium test scripts. Maximize() method works same as user click on browser maximize icon to maximize the window. Selenium test scripts can be run without maximizing windows as well but it is good practice to maximizing browser windows before running the tests on page.

selenium maximize() method