Last updated on August 1st, 2025 at 08:36 am
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() method example
package testPackage;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class maximizewindowExample {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "D:\chromedriver.exe");
WebDriver driver=new ChromeDriver();
//Minimize the browser window.
driver.manage().window().minimize();
driver.navigate().to("http://only-testing-blog.blogspot.com/2013/09/testing.html");
driver.findElement(By.xpath("//span[normalize-space()='Test Link']")).click();
driver.manage().window().maximize();
}
}
In above given example, minimize() method will minimize the chrome browser window.

Hi, I’m Aravind — a seasoned Automation Test Engineer with over 17 years of hands-on experience in the software testing industry. I specialize in tech troubleshooting and tools like Selenium, Playwright, Appium, JMeter, and Excel automation. Through this blog, I share practical tutorials, expert tips, and real-world insights to help testers and developers improve their automation skills.In addition to software testing, I also explore tech trends and user-focused topics, including Snapchat guides, codeless test automation, and more.