Last updated on August 1st, 2025 at 08:36 am
Maximize window in selenium
- Maximize() method in selenium is part of WebDriver.Window interface.
- It’s return type is void.
- It will maximize the current working browser window if it is not already maximized.
- This method is generally used just after launching the browser window in selenium test script.
- Syntax : driver.manage().window().maximize();
Selenium window maximize() example
package testPackage;
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();
//Maximize the browser window.
driver.manage().window().maximize();
driver.navigate().to("http://only-testing-blog.blogspot.com/2013/09/testing.html");
}
}
In above given example, we have used maximize() method after launching the browser. So initially browser will be launched and then maximize() method will maximize the 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.