Features

Maximize or resize browser window

Selenium WebDriver makes it possible to resize and maximize a browser window during an automated test.
Below you'll find examples on how to:

Maximize a window

The example below shows how to maximize the window to the full screen resolution (you can change the screen resolution as well).


driver.manage.window.maximize
driver.manage().window().maximize();
$web_driver->manage()->window()->maximize();
driver.maximize_window()
driver.manage().window().maximize();
driver.Manage().Window.Maximize();

Maximizing a window will only work on desktop browsers, not on mobile.

Resize a window

The example below shows how to resize the current window. If you specify a size larger than the current resolution, elements may appear off-screen.
Find out how to change the screen resolution.


driver.manage.window.resize_to(1920, 1080)
Dimension dimension = new Dimension(1920, 1080);
driver.manage().window().setSize(dimension);
$web_driver->manage()->window()->setSize(new WebDriverDimension(1920, 1080));
driver.set_window_size(1920, 1080)
driver.manage().window().setSize(1920, 1080);
driver.Manage().Window.Size = new Size(1920, 1080);

Resizing a window will only work on desktop browsers, not on mobile.